[Python-Dev] PEP487: Simpler customization of class creation

Ethan Furman ethan at stoneleaf.us
Fri Jul 29 13:23:50 EDT 2016


On 07/29/2016 08:01 AM, Martin Teichmann wrote:

> ... Also, while researching other
> people's code when I wrote PEP 487, I couldn't find any such code
> elsewhere, yet I found a lot of code where people took the wildest
> measure to prevent a metaclass in doing its job on the first class it
> is used for. One example is enum.EnumMeta, which contains code not to
> make enum.Enum an enum ...

Actually, enum.Enum is an enum.  The guards are there because part of creating a new
Enum class is searching for the previous Enum classes, and of course the very first
time through there is no previous Enum class.

My apologies if I have misunderstood what you were trying to say.

--
~Ethan~


More information about the Python-Dev mailing list