Inconsistent behavior of split on empty string

bk_kl at bk_kl at
Fri Feb 13 09:46:00 CET 2004


I think the following behavior of the build in function 'split' is inconsistent.
What do you think?

>>> "".split()
>>> "".split(";")

I'm using python 2.3.3 on Windows 2000.
(Perl's split only returns all items up to the last non-empty item,
 e.g. <perl>split /;/, "; ;;;"; gets you ['', ' ']. I find this confusing, too).

More information about the Python-list mailing list