[issue38045] Flag instance creation is slow

2019-09-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The fast method to check if the value is a power of two: not value & (value - 1) -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue38045] Flag instance creation is slow

2019-09-06 Thread Antony Lee
New submission from Antony Lee : Consider the following example from enum import Flag F = Flag("F", list("abcdefghijklm")) for idx in range(2**len(F) - 1): F(idx) creating all possible combos of 13 flags, so 8192 instances (yes, I know the instances are cached later, but