[Python-ideas] This seems like a wart to me...

skip at pobox.com skip at pobox.com
Thu Dec 11 15:18:32 CET 2008

Python 2 and 3 both exhibit this behavior:

    >>> "".split()
    >>> "".split("*")
    >>> "".split(" ")

It's not at all clear to me why splitting an empty string on implicit
whitespace should yield an empty list but splitting it with a non-whitespace
character or explicit whitespace should yield a list with an empty string as
its lone element.  I realize this is documented behavior, but I can't for
the life of me understand what the rationale might be for the different
behaviors.  Seems like a wart which might best be removed sometime in 3.x.


More information about the Python-ideas mailing list