Skip to content

Commit 6d8a602

Browse files
Cleaned up formatting and grammar
1 parent 29abc5a commit 6d8a602

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/writing/style.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ Python will lose track of its current position.
597597
if i > 4:
598598
a.remove(i)
599599
600-
Python has standard ways of filtering lists, but there are several things you need to consider
600+
Python has a few standard ways of filtering lists.
601+
You will need to consider
601602

602603
* Python 2.x vs. 3.x
603604
* Lists vs. iterators
@@ -606,19 +607,19 @@ Python has standard ways of filtering lists, but there are several things you ne
606607
Python 2.x vs. 3.x
607608
::::::::::::::::::
608609

609-
* Starting with Python 3.0, the :py:func:`map` and :py:func:`filter` functions return an iterator instead of a list. If you really need a list, you should wrap these functions in :py:func`list` like so
610+
Starting with Python 3.0, the :py:func:`filter` function returns an iterator instead of a list.
611+
If you really need a list, you should wrap it in :py:func:`list` like so
610612

611613
.. code-block:: python
612614
613-
list(map(...))
614615
list(filter(...))
615616
616-
* List comprehensions and generator expressions work the same in both 2.x and 3.x (except that comprehensions in 2.x "leak" variables into the enclosing namespace)
617+
List comprehensions and generator expressions work the same in both 2.x and 3.x (except that comprehensions in 2.x "leak" variables into the enclosing namespace)
617618

618619
* comprehensions create a new list object
619620
* generators iterate over the original list
620621

621-
* The filter function
622+
The :py:func:`filter` function
622623

623624
* in 2.x returns a list (use itertools.ifilter if you want an iterator)
624625
* in 3.x returns an iterator
@@ -663,7 +664,7 @@ Modifying the values in a list
663664
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
664665
**Bad**:
665666

666-
Remember that assignment never creates a new object. If 2 or more variables refer to the same list, changing one of them changes them all.
667+
Remember that assignment never creates a new object. If two or more variables refer to the same list, changing one of them changes them all.
667668

668669
.. code-block:: python
669670

0 commit comments

Comments
 (0)