[Python-checkins] r73300 - in python/branches/py3k/Doc/tutorial: controlflow.rst datastructures.rst

georg.brandl python-checkins at python.org
Mon Jun 8 20:59:09 CEST 2009


Author: georg.brandl
Date: Mon Jun  8 20:59:09 2009
New Revision: 73300

Log:
Elaborate encoding recommendations, and fix ambiguous wording for list comprehensions.

Modified:
   python/branches/py3k/Doc/tutorial/controlflow.rst
   python/branches/py3k/Doc/tutorial/datastructures.rst

Modified: python/branches/py3k/Doc/tutorial/controlflow.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/controlflow.rst	(original)
+++ python/branches/py3k/Doc/tutorial/controlflow.rst	Mon Jun  8 20:59:09 2009
@@ -675,7 +675,12 @@
   (see :ref:`tut-firstclasses` for more on classes and methods).
 
 * Don't use fancy encodings if your code is meant to be used in international
-  environments.  Plain ASCII works best in any case.
+  environments.  Python's default, UTF-8, or even plain ASCII work best in any
+  case.
+
+* Likewise, don't use non-ASCII characters in identifiers if there is only the
+  slightest chance people speaking a different language will read or maintain
+  the code.
 
 
 .. rubric:: Footnotes

Modified: python/branches/py3k/Doc/tutorial/datastructures.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/datastructures.rst	(original)
+++ python/branches/py3k/Doc/tutorial/datastructures.rst	Mon Jun  8 20:59:09 2009
@@ -162,12 +162,11 @@
 some operations applied to each member of the sequence, or to create a
 subsequence of those elements that satisfy a certain condition.
 
-
-Each list comprehension consists of an expression followed by a :keyword:`for`
-clause, then zero or more :keyword:`for` or :keyword:`if` clauses.  The result
-will be a list resulting from evaluating the expression in the context of the
-:keyword:`for` and :keyword:`if` clauses which follow it.  If the expression
-would evaluate to a tuple, it must be parenthesized.
+A list comprehension consists of brackets containing an expression followed
+by a :keyword:`for` clause, then zero or more :keyword:`for` or :keyword:`if`
+clauses.  The result will be a list resulting from evaluating the expression in
+the context of the :keyword:`for` and :keyword:`if` clauses which follow it.  If
+the expression would evaluate to a tuple, it must be parenthesized.
 
 Here we take a list of numbers and return a list of three times each number::
 
@@ -348,8 +347,8 @@
    >>> x, y, z = t
 
 This is called, appropriately enough, *sequence unpacking* and works for any
-sequence on the right-hand side.  Sequence unpacking requires the list of
-variables on the left to have the same number of elements as the length of the
+sequence on the right-hand side.  Sequence unpacking requires that there are as
+many variables on the left side of the equals sign as there are elements in the
 sequence.  Note that multiple assignment is really just a combination of tuple
 packing and sequence unpacking.
 


More information about the Python-checkins mailing list