Issue 1171994: error in documentation for splitting empty string (original) (raw)
Issue1171994
Created on 2005-03-28 17:49 by tungwaiyip, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Messages (3) | ||
|---|---|---|
| msg24811 - (view) | Author: Wai Yip Tung (tungwaiyip) | Date: 2005-03-28 17:49 |
| 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() [] | ||
| msg24812 - (view) | Author: Terry J. Reedy (terry.reedy) * ![]() |
Date: 2005-03-30 17:56 |
| 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. | ||
| msg24813 - (view) | Author: A.M. Kuchling (akuchling) * ![]() |
Date: 2005-06-08 21:48 |
| Logged In: YES user_id=11375 Fixed by rhettinger's commit in rev. 1.177. Thanks for reporting this! |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:10 | admin | set | github: 41769 |
| 2005-03-28 17:49:40 | tungwaiyip | create |
