@@ -350,7 +350,7 @@ Instead, use a list comprehension:
350350.. code-block :: python
351351
352352 four_lists = [[] for __ in xrange (4 )]
353-
353+
354354 Note: Use range() instead of xrange() in Python 3
355355
356356Create a string from a list
@@ -389,29 +389,29 @@ Take the following code for example:
389389 Even though both functions look identical, because *lookup_set * is utilizing
390390the fact that sets in Python are hashtables, the lookup performance
391391between the two is very different. To determine whether an item is in a list,
392- Python will have to go through each item until it finds a matching item.
392+ Python will have to go through each item until it finds a matching item.
393393This is time consuming, especially for long lists. In a set, on the other
394394hand, the hash of the item will tell Python where in the set to look for
395395a matching item. As a result, the search can be done quickly, even if the
396- set is large. Searching in dictionaries works the same way. For
396+ set is large. Searching in dictionaries works the same way. For
397397more information see this
398398`StackOverflow <http://stackoverflow.com/questions/513882/python-list-vs-dict-for-look-up-table >`_
399399page. For detailed information on the amount of time various common operations
400- take on each of these data structures, see
400+ take on each of these data structures, see
401401`this page <https://wiki.python.org/moin/TimeComplexity? >`_.
402402
403- Because of these differences in performance, it is often a good idea to use
404- sets or dictionaries instead of lists in cases where:
403+ Because of these differences in performance, it is often a good idea to use
404+ sets or dictionaries instead of lists in cases where:
405405
406406* The collection will contain a large number of items
407407
408408* You will be repeatedly searching for items in the collection
409409
410- * You do not have duplicate items.
410+ * You do not have duplicate items.
411411
412- For small collections, or collections which you will not frequently be
413- searching through, the additional time and memory required to set up the
414- hashtable will often be greater than the time saved by the improved search
412+ For small collections, or collections which you will not frequently be
413+ searching through, the additional time and memory required to set up the
414+ hashtable will often be greater than the time saved by the improved search
415415speed.
416416
417417
@@ -451,11 +451,17 @@ group <http://artifex.org/~hblanks/talks/2011/pep20_by_example.pdf>`_.
451451PEP 8
452452-----
453453
454- :pep: `8 ` is the de-facto code style guide for Python.
454+ :pep: `8 ` is the de-facto code style guide for Python. A high quality,
455+ easy-to-read version of PEP 8 is also available at `pep8.org <http://pep8.org/ >`_.
456+
457+ This is highly recommended reading. The entire Python community does their
458+ best to adhere to the guidelines laidout within this document. Some project
459+ may sway from it from time to time, while others may
460+ `ammend its recommendations <http://docs.python-requests.org/en/master/dev/contributing/#kenneth-reitz-s-code-style >`_.
455461
456- Conforming your Python code to PEP 8 is generally a good idea and helps make
457- code more consistent when working on projects with other developers. There
458- is a command-line program, `pep8 <https://github.com/jcrocholl/pep8 >`_,
462+ That being said, conforming your Python code to PEP 8 is generally a good
463+ idea and helps make code more consistent when working on projects with other
464+ developers. There is a command-line program, `pep8 <https://github.com/jcrocholl/pep8 >`_,
459465that can check your code for conformance. Install it by running the following
460466command in your terminal:
461467
0 commit comments