re.finditer
Sean 'Shaleh' Perry
shalehperry at attbi.com
Tue Jul 23 12:01:18 EDT 2002
>
> You want 'import sre'
>
>>>> import sre
>>>> import re
>>>> re.finditer('r+?','library')
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> AttributeError: 'module' object has no attribute 'finditer'
>>>> sre.finditer('r+?','library')
> <callable-iterator object at 0x4018dda0>
>
> Is this a documentation bug?
>
****WHAT****??????
import re simply is a wrapper around sre to hide the fact that around 1.5 the
regex engine was updated.
below is my re.py from 2.2.1.
engine = "sre"
# engine = "pre"
if engine == "sre":
# New unicode-aware engine
from sre import *
from sre import __all__
else:
# Old 1.5.2 engine. This one supports 8-bit strings only,
# and will be removed in 2.0 final.
from pre import *
from pre import __all__
so it looks like Lundh (or someone else) forgot to make finditer exportable
from sre.
More information about the Python-list
mailing list