[Python-ideas] IntFlags

Neil Girdhar mistersheik at gmail.com
Thu Mar 5 18:29:22 CET 2015


Have you looked at my IntFields generalization of IntFlags?  It seems that
many of your examples (permissions, e.g.) are better expressed with fields
than with flags.

On Thu, Mar 5, 2015 at 12:26 PM, Serhiy Storchaka <storchaka at gmail.com>
wrote:

> 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.
>
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
> --
>
> --- You received this message because you are subscribed to a topic in the
> Google Groups "python-ideas" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/python-ideas/L5KfCEXFaII/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150305/9cd9cee8/attachment.html>


More information about the Python-ideas mailing list