Bug or feature? 'abc'.split('') rejects empty separator
phansen at kaval.com
Mon Feb 11 02:39:58 CET 2002
Erik Max Francis wrote:
> That's what list('abc') would return. But in actuality, for it to be
> consistent with the rest of string.split's behavior, 'abc'.split('')
> would have to return ['', 'a', 'b', 'c', ''], not ['a', 'b', 'c'].
> Another beautiful example of why string.split('') should raise an error
> instead of trying to guess what you mean.
>>> ''.join(['ab', 'c'])
So what should 'abc'.split('') return again?
More information about the Python-list