[Python-ideas] IntFlags
Serhiy Storchaka
storchaka at gmail.com
Thu Mar 5 18:26:40 CET 2015
On 05.03.15 18:15, Luciano Ramalho wrote:
> I don't like the name IntFlags: BitFlags makes more sense to me, since
> the key feature is supporting bitwise operators.
I chose this name because the concept IntFlags is very similar to the
concept of Flags enums in C#. The Flags decorator in C# is as close to
IntFlags as enums in C# close to IntEnum. The Int prefix is here because
IntFlags is just an funny int (as IntEnum) and both IntFlags and IntEnum
are purposed to replace int constants.
> Calling it BitFlags has the additional advantage of making it very
> clear that it's not closely related to IntEnum.
But it is closely related to IntEnum. Both are int subclass and fully
compatible with ints, both provides named constants, both have funny str
and repr, both inherit common useful interface from Enum, both are
purposed to replace integer constants.
More information about the Python-ideas
mailing list