[Python-ideas] Enums

Paul Colomiets paul at colomiets.name
Mon Jul 25 22:05:28 CEST 2011

On Mon, Jul 25, 2011 at 9:47 PM, Raymond Hettinger
<raymond.hettinger at gmail.com> wrote:
> On Jul 25, 2011, at 1:06 PM, Michael Foord wrote:
> Python standard library modules currently using integers for constants:
> * re - has flags (OR'able constants) defined in sre_constants, each flag has
> two names (e.g. re.IGNORECASE and re.I)
> What is being proposed here?  Will there be a new namespace so that we would
> start writing re.Flags.IGNORECASE instead of re.IGNORECASE?  Are module
> level constants now going to be considered bad-form?
> If constants switch from re.IGNORECASE to re.flags.IGNORECASE, are there any
> benefits to compensate for being both wordier and slower?

Well, I'll be happy to write:

    from re import compile as re, Flags as ref

(not sure exact names, but you've got the idea)


More information about the Python-ideas mailing list