[Python-ideas] IntFlags
Rob Cliffe
rob.cliffe at btinternet.com
Thu Mar 5 01:18:27 CET 2015
> It may require some sanity check for users only
> defining "combination constants" in the class such that the result
> could not be represented.
>
> class Stupid(IntFlags):
> CAT = 3
> DOG = 6
>
> in which case ~CAT would not make sense, but neither could CAT | DOG
> be represented. I suppose in such cases an error should be raised by
> the metaclass on class definition.
>
> -Alexander
Personally, I find that CAT & DOG is almost invariably an error. :-)
More information about the Python-ideas
mailing list