[Python-Dev] "funny".split("")
Christian Tismer
tismer@tismer.com
Tue, 12 Mar 2002 21:10:56 +0100
Fredrik Lundh wrote:
> david abrahams wrote:
>
>
>
>>There's a reason to pursue the OP's expected result as opposed to just
>>settling for list("funny"). If we pick a reasonable behavior for this
>>case, it will save some number of people from having to write:
>>
>> if len(sep):
>> divided = s.split(sep)
>> else:
>> divided = list(s)
>>
>
> (where the number is very close to zero, and where number times
> the time needed to type in the above workaround is much less than
> the amount of time you've all wasted by contributing to this thread)
But it was fun, a bit.
> btw, here's another data point:
>
>
>>>>import re
>>>>re.split("", "funny")
>>>>
> ['funny']
There are good arguments to have the one or the other
behavior. I'm not ambitious for any of them,
but it would save brain cells to have the same
behavior on this special case for re and "".split.
ciao - chris
--
Christian Tismer :^) <mailto:tismer@tismer.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Kaunstr. 26 : *Starship* http://starship.python.net/
14163 Berlin : PGP key -> http://wwwkeys.pgp.net/
PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF
where do you want to jump today? http://www.stackless.com/