[issue23591] enum: Add Flags and IntFlags
Ethan Furman
report at bugs.python.org
Tue Aug 30 15:42:06 EDT 2016
Ethan Furman added the comment:
Since we're using re as the sample, here's where re.I is defined:
Lib/re.py:
---------
I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case
As already mentioned, re.I results in 2, and a re.compile object is not usable as a re flag.
> Also, I suppose that means you've given up on the autocreation
We decided auto-created values were too magical for the stdlib (see issue26988). They will exist in my aenum package, though.
> (since the values _are_ semantical here),
The values have meaning because the underlying library gave them meaning; so assuming a type of Flags are used, they will be IntFlags.
> and I suppose you'll require all the declared values to be powers of 2.
Nope. You are welcome to give more meaningful names to different combinations of powers of two.
> With those conditions, I think this is a good enhancement of Python.
Hopefully you still think so. ;)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23591>
_______________________________________
More information about the Python-bugs-list
mailing list