[Python-Dev] Review of PEP 520: Ordered Class Definition Namespace

Eric Snow ericsnowcurrently at gmail.com
Tue Jun 21 20:33:11 EDT 2016

On Tue, Jun 21, 2016 at 3:21 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> It occurs to me that a settable __definition_order__ provides a
> benefit that an ordered tp_dict doesn't: to get the "right" definition
> order in something like Cython or dynamic type creation, you don't
> need to carefully craft the order in which attributes are defined, you
> just need to set __definition_order__ appropriately.
> It also means that the "include dunder-attributes or not" decision is
> easy to override, regardless of what we set as the default.
> By contrast, if the *only* ordering information is
> cls.__dict__.keys(), then there's no way for a type implementor to
> hide implementation details.

Good point.  I'll make a note of this in the PEP.


More information about the Python-Dev mailing list