[Python-Dev] Bug 911080, string split oddness
Pete Shinners
pete at shinners.org
Sat Mar 6 15:52:13 EST 2004
I just filed Bug #911080. Sorry if this has been discussed before, at
minimum I believe there should be a documentation fix.
http://sourceforge.net/tracker/index.php?func=detail&aid=911080&group_id=5470&atid=105470
Basically this documents the difference between
"a b c".split()
"a b c".split(" ")
This is a quirky little change in behavior that I've seen confuse newbies.
Unfortunately there are needs for both styles of splitting.
In a world where backward breaking changes aren't a big deal, I would think
split() would always work like the first version, and splitfields() would
change to work like the second version. But that would break just about
everything, so I suppose split either needs another optional argument or a
different split method. (splitgroup? splitseq?)
The only workaround is to use regular expression splitting. But that's not a
direction I like to point newbies towards too quickly.
More information about the Python-Dev
mailing list