RE vs. SRE

Michael Hoffman cam.ac.uk at mh391.invalid
Sun Aug 21 05:26:51 EDT 2005


Yoav wrote:
> What is the difference between the two? Which on is better to use and why?

In Python 2.4, this is what's in re.py:

'''
"""Minimal "re" compatibility wrapper.  See "sre" for documentation."""

engine = "sre" # Some apps might use this undocumented variable

from sre import *
from sre import __all__
'''

If you're using CPython, they're the same thing now. Use re, because sre 
is really an undocumented implementation detail of re.
-- 
Michael Hoffman



More information about the Python-list mailing list