[issue46132] Attempting to create an enum with slots silently fails

Christian Heimes report at bugs.python.org
Sun Dec 19 17:57:17 EST 2021


Christian Heimes <lists at cheimes.de> added the comment:

The primary purpose of __slots__ is not to limit attribute assignment. Slots are useful to define types that have a smaller memory footprint than types.

You are getting the expected behavior. Enum parent class does not have __slots__ and therefore automatically has a __dict__. You could make an argument to add __slots__ to Enum, but that would be a new feature for 3.11.

----------
nosy: +christian.heimes

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46132>
_______________________________________


More information about the Python-bugs-list mailing list