[Python-Dev] Deprecating whrandom; and deprecating in general
Fredrik Lundh
fredrik@pythonware.com
2002年4月11日 20:17:19 +0200
Guido van Rossum wrote:
> > We can't update that code to use re because the script will have
> > to expose the exact same semantics as regex provides and I don't
> > know how to do this reliably with re (pcre or SRE).
afaik, regex and re has exactly the same semantics. it's the
syntax that differs, in various intricate ways.
> I'm not sure I understand. Are these other packages generating
> regular expressions in the regex syntax that your script then applies
> somewhere? This is indeed a problem -- unless you can keep your
> customers on Python <= 2.2 forever, eventually the regex module will
> die of old age.
maybe the libraries take RE patterns as input?
> Perhaps what's necessary is a translation module that translates the
> regex syntax into re syntax?
>>> import reconvert
>>> help(reconvert)
Help on module reconvert:
NAME
reconvert - Convert old ("regex") regular expressions to new syntax ("re").
(I'll comment on the rest of this discussion later, when I've
rebooted my brain)
</F>