[issue46132] Consider adding __slots__ to enums?

2021-12-19 Thread Ethan Furman
Ethan Furman added the comment: Some testing reveals that `__slots__` is not a good option for Enum -- it makes it impossible to mix in in other types such as `int`. -- ___ Python tracker

[issue46132] Consider adding __slots__ to enums?

2021-12-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: > In which case: consider this a feature request to > consider adding __slots__ ... A few thoughts: * Enumerations tend to be small, so a space savings likely isn't relevant. * In Python 3.11, the speed advantage of slots is now much smaller. * The code

[issue46132] Consider adding __slots__ to enums?

2021-12-19 Thread Alex Waygood
Alex Waygood added the comment: Ah, of course, I'm an idiot — I forgot that a class could not prevent the creation of __dict__ unless the parent class also had __slots__. Thanks, Christian. In which case: consider this a feature request to consider adding __slots__ to enum.Enum: for faster