[Python-Dev] PEP 557: Data Classes

Ethan Furman ethan at stoneleaf.us
Thu Oct 12 20:56:41 EDT 2017


On 10/12/2017 03:44 PM, Chris Barker wrote:
> I think we've drifted into a new topic, but...

> I was thinking about this last spring, when I tried to cram all sorts of python metaprogramming into one 3hr class...
>
> Trying to come up with a an exam[ple for metclasses, I couldn't come up with anything that couldn't be done more claerly
> (to me) with a class decorator.

The Enum data type requires metaclasses.

Any time you want to modify the behavior of a class (not its instances, the class itself) you need a metaclass.

Agreed that it's pretty rare, but we need them.

--
~Ethan~



More information about the Python-Dev mailing list