[Python-bugs-list] [ python-Bugs-811604 ] "string".split behaviour for empty strings

SourceForge.net noreply at sourceforge.net
Wed Sep 24 04:45:50 EDT 2003


Bugs item #811604, was opened at 2003-09-24 13:50
Message generated for change (Settings changed) made by meyarivan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=811604&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: T.Meyarivan (meyarivan)
Assigned to: Nobody/Anonymous (nobody)
>Summary: "string".split behaviour for empty strings

Initial Comment:


"".split() -> []



"".split(' ') -> ['']



It is not clear from the documentation as to what is

the defined behaviour in the above case. To say the

least, it is 

completely counter-intuitive..(splitting an empty

string should

return the list [''] in both cases).



>From stringobject.c, the behaviour of split_whitespace

(i.e split called without sep) and string_split (split

called with sep) is different for empty

strings..perhaps the function split_whitespace needs to

be patched.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=811604&group_id=5470



More information about the Python-bugs-list mailing list