Strange re behavior: normal?

Mike Rovner mike at nospam.com
Fri Aug 15 13:38:12 EDT 2003


Fredrik Lundh wrote:
> Mike Rovner wrote:
>> IMHO that split behavior is a bug although technicaly it is not.
>> (From re manual:
>> "This module provides regular expression matching operations similar
>> to those found in Perl.")
>
> is "split" really a matching operation?
>
> fact is, all methods have Python-specific behaviour.  it's just the RE
> language itself that's based on Perl.

With all due respect to Python and not trying to bend it to any other
language
I believe it trys to do what user expects.

string.split() splits on (clearly documented nonempty) substring.
re.split() splits on RE.
splut(r'\b',...) clearly means (at least for me) 'split on word boundary'
It doesn't reject it (as in r'\b?') nor provide expected behavior.

I understand why it does what it does, but don't agree with it.

Regards,
Mike








More information about the Python-list mailing list