Kaydet (Commit) 44a31e1d authored tarafından Andrew M. Kuchling's avatar Andrew M. Kuchling

Use 'input' as variable name, even though it shadows a built-in

Remove applications of rsplit() and random numbers
Typo fixes; minor tweaks
üst 6237ef1d
...@@ -109,8 +109,8 @@ iterators. If you want to reverse an iterator, first convert it to ...@@ -109,8 +109,8 @@ iterators. If you want to reverse an iterator, first convert it to
a list with \function{list()}. a list with \function{list()}.
\begin{verbatim} \begin{verbatim}
>>> data = open('/etc/passwd', 'r') >>> input= open('/etc/passwd', 'r')
>>> for line in reversed(list(data)): >>> for line in reversed(list(input)):
... print line ... print line
... ...
root:*:0:0:System Administrator:/var/root:/bin/tcsh root:*:0:0:System Administrator:/var/root:/bin/tcsh
...@@ -137,8 +137,7 @@ fill character other than a space. ...@@ -137,8 +137,7 @@ fill character other than a space.
\item Strings also gained an \method{rsplit()} method that \item Strings also gained an \method{rsplit()} method that
works like the \method{split()} method but splits from the end of works like the \method{split()} method but splits from the end of
the string. Possible applications include splitting a filename the string.
from a path or a domain name from URL.
\begin{verbatim} \begin{verbatim}
>>> 'a b c'.split(None, 1) >>> 'a b c'.split(None, 1)
...@@ -236,7 +235,7 @@ yellow 5 ...@@ -236,7 +235,7 @@ yellow 5
\item The \function{zip()} built-in function and \function{itertools.izip()} \item The \function{zip()} built-in function and \function{itertools.izip()}
now return an empty list instead of raising a \exception{TypeError} now return an empty list instead of raising a \exception{TypeError}
exception if called with no arguments. This makes the function more exception if called with no arguments. This makes them more
suitable for use with variable length argument lists: suitable for use with variable length argument lists:
\begin{verbatim} \begin{verbatim}
...@@ -354,9 +353,9 @@ default is 2. ...@@ -354,9 +353,9 @@ default is 2.
Note that \function{tee()} has to keep copies of the values returned Note that \function{tee()} has to keep copies of the values returned
by the iterator; in the worst case, it may need to keep all of them. by the iterator; in the worst case, it may need to keep all of them.
This should therefore be used carefully if there the leading iterator This should therefore be used carefully if the leading iterator
can run far ahead of the trailing iterator in a long stream of inputs. can run far ahead of the trailing iterator in a long stream of inputs.
If the separation is large, then it becomes preferrable to use If the separation is large, then it becomes preferable to use
\function{list()} instead. When the iterators track closely with one \function{list()} instead. When the iterators track closely with one
another, \function{tee()} is ideal. Possible applications include another, \function{tee()} is ideal. Possible applications include
bookmarking, windowing, or lookahead iterators. bookmarking, windowing, or lookahead iterators.
...@@ -385,8 +384,7 @@ For example: ...@@ -385,8 +384,7 @@ For example:
\item The \module{random} module has a new method called \method{getrandbits(N)} \item The \module{random} module has a new method called \method{getrandbits(N)}
which returns an N-bit long integer. This method supports the existing which returns an N-bit long integer. This method supports the existing
\method{randrange()} method, making it possible to efficiently generate \method{randrange()} method, making it possible to efficiently generate
arbitrarily large random numbers (suitable for prime number generation in arbitrarily large random numbers.
RSA applications for example).
\item The regular expression language accepted by the \module{re} module \item The regular expression language accepted by the \module{re} module
was extended with simple conditional expressions, written as was extended with simple conditional expressions, written as
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment