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

Steve Holden sholden at holdenweb.com
Mon Feb 11 07:56:40 EST 2002


"Roy Smith" <roy at panix.com> wrote in message
news:roy-F1119D.17441210022002 at news1.panix.com...
> Erik Max Francis <max at alcyone.com> wrote:
> > That is simply not comparable.  The purpose of split is to divide up a
> > string according to a delimiter.  Asking for it to split a string given
> > a null delimiter doesn't make much sense at all;
>
> I think it makes plenty of sense.
>
I don't .

[legal null constructs]
>
> You could make rational arguments that none of them "make much sense at
> all", and that they are all likely to be errors, but you'd get arguments
> that to outlaw them would destroy the orthogonality of the language.
>
> But I think the strongest argument in favor of allowing '' as an argument
> to split() is the join() symmetry argument.

In that case, since a*0 is legal, presumably you want to make division by
zero legal for symmetry, too?

regards
 Steve
--
Consulting, training, speaking: http://www.holdenweb.com/
Author, Python Web Programming: http://pydish.holdenweb.com/pwp/

"This is Python.  We don't care much about theory, except where it
intersects with useful practice."  Aahz Maruch on c.l.py







More information about the Python-list mailing list