19 Jan
2021
19 Jan
'21
12:29 a.m.
On 1/18/21 5:53 PM, Ethan Furman wrote:
`__prepare__` returns a dict-like namespace that is used as is. `EnumMeta` uses `__prepare__` to return an instance of `_EnumDict`.
When `type.__new__` is called, whatever the namespace used to be is then converted into a normal Python dict, and a mappingproxy is returned for all further `cls.__dict__` requests.
To be more precise, when `__prepare__` is called, there is no class, and therefore no `class.__dict__`. -- ~Ethan~