[Python-Dev] PEP 487: Simpler customization of class creation (original) (raw)

Martin Teichmann lkb.teichmann at gmail.com
Thu Jun 16 17:17:14 EDT 2016


Hi Eric, hi List,

I'd be glad to give feedback on this, probably later today or tomorrow. In particular, I'd like to help resolve the intersection with PEP 520. :)

Thanks in advance! Let me already elaborate on the differences, so that others can follow:

You chose the name "definition_order", I chose "attribute_order", I am fine with either, what are other people's opinions?

The bigger difference is actually the path to inclusion into Python: my idea is to first make it a standard library feature, with the later option to put it into the C core, while you want to put the feature directly into the C core. Again I'm fine with either, as long as the feature is eventually in.

As a side note, you propose to use OrderedDict as the class definition namespace, and this is exactly how I implemented it. Nonetheless, I would like to keep this fact as an implementation detail, such that other implementations of Python (PyPy comes to mind) or even CPython at a later time may switch to a different way to implement this feature. I am thinking especially about the option to determine the -order_ already at compile time. Sure, this would mean that someone could trick us by dynamically changing the order of attribute definition, but I would document that as an abuse of the functionality with undocumented outcome.

Greetings

Martin



More information about the Python-Dev mailing list