[Python-ideas] A way out of Meta-hell (was: A (meta)class algebra)

Joao S. O. Bueno jsbueno at python.org.br
Sun Feb 22 16:15:21 CET 2015


On 22 February 2015 at 11:54, Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> Ah, thank you: this discussion kicked a new naming idea lose in my
> brain, so I just pushed an update to PEP 422 that renames the proposed
> __init_class__ hook to be called __autodecorate__ instead.
>
> "It's an implicitly invoked class decorator that gets inherited by
> subclasses" is really the best way to conceive of the proposed hook,
> so having "init" as part of the name not only made it hard to remember
> whether the hook was __init_class__ or __class_init__, it also got
> people thinking along completely the wrong lines.
>
> By contrast, the "auto" in "autodecorate" only makes sense as a
> prefix, and the inclusion of the word "decorate" in the name means it
> should be far more effective at triggering the reader's "class
> decorator" mental model rather than their "class initialisation" one.

Why not just "__decorate__" instead?


More information about the Python-ideas mailing list