"re" vs "sre"?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Sat Sep 23 07:51:06 EDT 2006


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?



More information about the Python-list mailing list