diff options
Diffstat (limited to 'Doc/whatsnew/2.0.rst')
-rw-r--r-- | Doc/whatsnew/2.0.rst | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst index 8c740ee..ace396b 100644 --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -284,7 +284,7 @@ write the following to do it:: L) Because of Python's scoping rules, a default argument is used so that the -anonymous function created by the :keyword:`lambda` statement knows what +anonymous function created by the :keyword:`lambda` expression knows what substring is being searched for. List comprehensions make this cleaner:: sublist = [ s for s in L if string.find(s, S) != -1 ] @@ -296,11 +296,11 @@ List comprehensions have the form:: for exprN in sequenceN if condition ] -The :keyword:`for`...\ :keyword:`in` clauses contain the sequences to be +The :keyword:`!for`...\ :keyword:`!in` clauses contain the sequences to be iterated over. The sequences do not have to be the same length, because they are *not* iterated over in parallel, but from left to right; this is explained more clearly in the following paragraphs. The elements of the generated list -will be the successive values of *expression*. The final :keyword:`if` clause +will be the successive values of *expression*. The final :keyword:`!if` clause is optional; if present, *expression* is only evaluated and added to the result if *condition* is true. @@ -316,7 +316,7 @@ following Python code:: # the expression to the # resulting list. -This means that when there are multiple :keyword:`for`...\ :keyword:`in` +This means that when there are multiple :keyword:`!for`...\ :keyword:`!in` clauses, the resulting list will be equal to the product of the lengths of all the sequences. If you have two lists of length 3, the output list is 9 elements long:: @@ -541,8 +541,8 @@ true if *obj* is present in the sequence *seq*; Python computes this by simply trying every index of the sequence until either *obj* is found or an :exc:`IndexError` is encountered. Moshe Zadka contributed a patch which adds a :meth:`__contains__` magic method for providing a custom implementation for -:keyword:`in`. Additionally, new built-in objects written in C can define what -:keyword:`in` means for them via a new slot in the sequence protocol. +:keyword:`!in`. Additionally, new built-in objects written in C can define what +:keyword:`!in` means for them via a new slot in the sequence protocol. Earlier versions of Python used a recursive algorithm for deleting objects. Deeply nested data structures could cause the interpreter to fill up the C stack |