Regular Expression: Bug in findall?

Tim Peters tim.one at comcast.net
Fri Oct 18 20:38:05 EDT 2002


[Claude-Guy Quimper]
> 	I am wandering why the two output lines in this
> program are not the same. I am using Python 2.1.3.
>
> Code:
>
> from re import *
>
> s = """32
> 34
> 5433
> 443 """
>
> print findall("([0-9])", s)
> print findall("([0-9])", s, MULTILINE)

It's because you're using 2.1.  In 2.2 or 2.3, you'll get a TypeError,
because re.findall() doesn't take 3 arguments; a bug in 2.1's findall
prevented it from catching this mistake (it did something senseless with a
3rd argument).





More information about the Python-list mailing list