[Python-Dev] "funny".split("")

Christian Tismer tismer@tismer.com
Tue, 12 Mar 2002 20:07:30 +0100


Andrew Koenig wrote:

> Christian> Eeeeehhh!
> Christian> That sounds very good.
> Christian> It can make me unconvinced again, of course.
> Christian> Split can never return the separator,
> Christian> that makes the number of possible answers
> Christian> not only finite, but unique!
> 
> Also, note that it does allow for empty elements in the result,
> provided that the separator is not empty:
> 
>     >>> "a//b".split("/")
>     ['a', '', 'b']


Sure. The single rule "split whenever you can, but don't
return the separator" make this operation closed.
Although split and join can never be true friends,
since they aren't real counterparts:
join() does accept strings which contain the concatenator.

Maybe somebody will use this to kill the argument.

maybe-somebody-with-a-<wink>-ly y'rs - 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/