Behavior of re.split on empty strings is unexpected
nagle at animats.com
Tue Aug 3 19:41:57 CEST 2010
On 8/2/2010 5:53 PM, samwyse wrote:
> On Aug 2, 12:34 pm, John Nagle<na... at animats.com> wrote:
>> The regular expression "split" behaves slightly differently than string
> I'm going to argue that it's the string split that's behaving oddly.
I tend to agree.
It doesn't seem to be possible to get the same semantics with
any regular expression split. The default "split" has a special
case for head and tail whitespace, and there's no way to express
that with a regular expression split. Applying "strip" first
will work, of course. The documentation should reflect
More information about the Python-list