"re" vs "sre"?
Peter Otten
__peter__ at web.de
Sat Sep 23 08:11:58 EDT 2006
Lawrence D'Oliveiro wrote:
> I learned about Python regular expressions from the Web documentation
> <http://docs.python.org/lib/lib.html>. This describes a module named "re".
> Then I saw some code written by a colleague, and he was using a module
> named "sre". I checked my Python 2.4.3 installation, and sure enough, I
> have a module named "sre" as well as "re". Curious, I fired up an
> interactive Python session, and looked to see what the docstrings were for
> these modules. And for the "re" module, the help says:
>
> re - Minimal "re" compatibility wrapper. See "sre" for documentation.
>
> and "sre" seems to have the more complete set of docstrings.
>
> So which one should we be using?
Here's what Python 2.5 has to say on the matter:
>>> import sre
__main__:1: DeprecationWarning: The sre module is deprecated, please import
re.
Peter
More information about the Python-list
mailing list