Bug or feature? 'abc'.split('') rejects empty separator

Neil Schemenauer nas at python.ca
Sun Feb 10 17:50:42 EST 2002


Bengt Richter wrote:
>  >>> 'abc'.split('')
>  Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>  ValueError: empty separator
> 
> Wouldn't it make sense to return list('abc') ?

It would also make sense to return ['a', 'b', 'c'].  Since it's not
obvious what you want Python raises an error.

  Neil




More information about the Python-list mailing list