re module: Nothing to repeat, but no sre_constants.error: nothing to repeat ?

Devin Jeanpierre jeanpierreda at gmail.com
Tue Feb 14 20:43:05 EST 2012


On Tue, Feb 14, 2012 at 1:05 PM, MRAB <python at mrabarnett.plus.com> wrote:
>> And yeah, even something as crazy as ()* works, but as soon as it
>> becomes (a*)* it doesn't work. Weird.
>>
> I think it's a combination of warning the user about something that's
> pointless,
> as in the case of "$*", and producing a pattern which could cause the
> internal
> regex engine to get stuck in an infinite loop.

Considering that ()* works fine, I can't imagine it ever gets stuck in
infinite loops. But I admit I am too lazy to check against the
interpreter.

Also, complete failure is an exceptionally (heh) poor way of warning
people about stuff. I hope that's not really it.

-- Devin



More information about the Python-list mailing list