[Python-Dev] stat module in C -- what to do with stat.py?

Ethan Furman ethan at stoneleaf.us
Fri Jun 21 00:19:55 CEST 2013

On 06/20/2013 01:27 PM, Guido van Rossum wrote:
> On Thu, Jun 20, 2013 at 1:18 PM, Amaury Forgeot d'Arc wrote:
>> 2013/6/20 Serhiy Storchaka wrote:
>>> Now with enumerations in the stdlib the stat module constants are
>>> candidates for flag enumerations. How easy will be implement it on C?
>> Aha. Should an internal C module fetch the value of the constants, and a
>> public stat.py nicely wrap them in enums?
> But aren't most of these masks? enum.IntEnum doesn't handle those very
> gracefully (the | operator returns a plain int).

As is, IntEnum would not be a great choice.

We could either add a another Enum (BitMaskEnum?) that was also int-based, or flesh out IntEnum with enough smarts to 
handle |, &, and ^ and return an IntEnum when possible and fall back to a plain int when not possible.


More information about the Python-Dev mailing list