Re: Behaviour of str.split

2005-04-20 Thread David Fraser
Greg Ewing wrote: Will McGugan wrote: Hi, I'm curious about the behaviour of the str.split() when applied to empty strings. .split() returns an empty list, however.. .split(*) returns a list containing one empty string. Both of these make sense as limiting cases. Consider a b c.split

Re: Behaviour of str.split

2005-04-20 Thread Bengt Richter
On Wed, 20 Apr 2005 10:55:18 +0200, David Fraser [EMAIL PROTECTED] wrote: Greg Ewing wrote: Will McGugan wrote: Hi, I'm curious about the behaviour of the str.split() when applied to empty strings. .split() returns an empty list, however.. .split(*) returns a list containing one empty

Re: Behaviour of str.split

2005-04-20 Thread David Fraser
Bengt Richter wrote: On Wed, 20 Apr 2005 10:55:18 +0200, David Fraser [EMAIL PROTECTED] wrote: Greg Ewing wrote: Will McGugan wrote: Hi, I'm curious about the behaviour of the str.split() when applied to empty strings. .split() returns an empty list, however.. .split(*) returns a list

Re: Behaviour of str.split

2005-04-19 Thread Greg Ewing
Will McGugan wrote: Hi, I'm curious about the behaviour of the str.split() when applied to empty strings. .split() returns an empty list, however.. .split(*) returns a list containing one empty string. Both of these make sense as limiting cases. Consider a b c.split() ['a', 'b', 'c'] a b.split

Re: Behaviour of str.split

2005-04-18 Thread runes
The behaviour of .split(*) is not that strange as the splitpoint always disappear. The re.split() have a nice option to keep the splitpoint which the str.split should have, I think. One expectation I keep fighting within myself is that I expect mystring.split('') to return ['m', 'y', 's', 't',

Re: Behaviour of str.split

2005-04-18 Thread Tim N. van der Leeuw
runes wrote: The behaviour of .split(*) is not that strange as the splitpoint always disappear. The re.split() have a nice option to keep the splitpoint which the str.split should have, I think. One expectation I keep fighting within myself is that I expect mystring.split('') to return

Re: Behaviour of str.split

2005-04-18 Thread runes
[Tim N. van der Leeuw] Fortunately, this is easy to write as: list(mystring). Sure, and map(None, mystring) Anyways, I have settled with this bevaviour, more or less ;-) Rune -- http://mail.python.org/mailman/listinfo/python-list

Re: Behaviour of str.split

2005-04-18 Thread John Machin
On Mon, 18 Apr 2005 16:16:00 +0100, Will McGugan [EMAIL PROTECTED] wrote: Hi, I'm curious about the behaviour of the str.split() when applied to empty strings. .split() returns an empty list, however.. .split(*) returns a list containing one empty string. I would have expected the second

Re: Behaviour of str.split

2005-04-18 Thread Raymond Hettinger
[Will McGugan] I'm curious about the behaviour of the str.split() when applied to empty strings. .split() returns an empty list, however.. .split(*) returns a list containing one empty string. [John Machin] You are missing a perusal of the documentation. Had you done so, you would have