[issue2636] Adding a new regex module (compatible with re)

Steven D'Aprano report at bugs.python.org
Fri Sep 2 04:13:11 CEST 2011


Steven D'Aprano <steve+python at pearwood.info> added the comment:

Matthew Barnett wrote:
> Matthew Barnett <python at mrabarnett.plus.com> added the comment:
> 
> I think I need a show of hands.
> 
> Should the default be old behaviour (like re) or new behaviour? (It might be old now, new later.)
> 
> Should there be a NEW flag (as at present), or an OLD flag, or a VERSION parameter (0=old, 1=new, 2=?)?

I prefer Antoine's suggested spelling, COMPAT, rather than OLD.

How would you write the various options? After the transition is easy:

     # Get backwards-compatible behaviour:
     compile(string, COMPAT)
     compile(string, VERSION0)

     # Get regex non-compatible behaviour:
     compile(string)  # will be the default in the future
     compile(string, VERSION1)

But what about during the transition, when backwards-compatible 
behaviour is the default? There needs to be a way to turn compatibility 
mode off, not just turn it on.

     # Get backwards-compatible behaviour:
     compile(string)  # will be the default for a release or two
     compile(string, COMPAT)
     compile(string, VERSION0)

     # Get regex non-compatible behaviour:
     compile(string, VERSION1)

So I guess my preference is VERSION0 and VERSION1 flags, even if there 
is never going to be a VERSION2.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2636>
_______________________________________


More information about the Python-bugs-list mailing list