[Python-checkins] r47192 - sandbox/trunk/Doc/functional.rst
andrew.kuchling
python-checkins at python.org
Sat Jul 1 19:34:41 CEST 2006
Author: andrew.kuchling
Date: Sat Jul 1 19:34:40 2006
New Revision: 47192
Modified:
sandbox/trunk/Doc/functional.rst
Log:
Change example from .strip() to .split() -- I used split() a lot, it turns out; fix a typo
Modified: sandbox/trunk/Doc/functional.rst
==============================================================================
--- sandbox/trunk/Doc/functional.rst (original)
+++ sandbox/trunk/Doc/functional.rst Sat Jul 1 19:34:40 2006
@@ -436,8 +436,8 @@
::
- (line.strip() for line in line_list) =>
- 'line 1', 'line 2'
+ (line.split() for line in line_list) =>
+ ['line', '1'], ['line', '2']
Generator expressions always have to be written inside parentheses, as
in the above example. The parentheses signalling a function call also
@@ -812,7 +812,7 @@
If there's a Python built-in or a module function that's suitable, you
don't need to define a new function at all::
- stripped_lines = [line.strip for line in lines]
+ stripped_lines = [line.strip() for line in lines]
existing_files = filter(os.path.exists, file_list)
If the function you need doesn't exist, you need to write it. One way
@@ -1133,7 +1133,7 @@
The author would like to thank the following people for offering
suggestions, corrections and assistance with various drafts of this
-article: Raymond Hettinger, Jim Jewett.
+article: Ian Bicking, Raymond Hettinger, Jim Jewett.
Version 0.1: posted June 30 2006.
More information about the Python-checkins
mailing list