[ python-Bugs-1171994 ] error in documentation for splitting empty string
SourceForge.net
noreply at sourceforge.net
Wed Jun 8 23:48:44 CEST 2005
Bugs item #1171994, was opened at 2005-03-28 12:49
Message generated for change (Settings changed) made by akuchling
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1171994&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Wai Yip Tung (tungwaiyip)
Assigned to: Nobody/Anonymous (nobody)
Summary: error in documentation for splitting empty string
Initial Comment:
Below is extracted from http://www.python.org/doc/2.4/
lib/string-methods.html describing the string method
split().
-----------------------------------------------------------------------
split([sep [,maxsplit]])
... Splitting an empty string with a specified separator
returns an empty list.
If sep is not specified or is None, a different splitting
algorithm is applied. ... Splitting an empty string returns
"['']".
-----------------------------------------------------------------------
The rationale for different treatment of splitting an empty
string seems to be discussed in 811604. However the
documentation seems to be the opposite of actual result.
>>> ''.split(',')
['']
>>> ''.split()
[]
----------------------------------------------------------------------
>Comment By: A.M. Kuchling (akuchling)
Date: 2005-06-08 17:48
Message:
Logged In: YES
user_id=11375
Fixed by rhettinger's commit in rev. 1.177. Thanks for
reporting this!
----------------------------------------------------------------------
Comment By: Terry J. Reedy (tjreedy)
Date: 2005-03-30 12:56
Message:
Logged In: YES
user_id=593130
The new 2.4.1 doc (released today) at
http://docs.python.org/lib/string-methods.html
remains the same.
Verified behavior on 2.2. If unchanged (lest code be broken),
there does seem to be a problem.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1171994&group_id=5470
More information about the Python-bugs-list
mailing list