[Python-3000] PEP 3124 - Overloading, Generic Functions, Interfaces, etc.

Phillip J. Eby pje at telecommunity.com
Tue May 1 20:51:58 CEST 2007


At 02:13 PM 5/1/2007 -0400, Jim Jewett wrote:
>On 5/1/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> > Yup, and we're still not now.  :)  Or at least, I don't understand what the
> > code below does, or more precisely, why it's different from just having a
> > __decorators__ list containing direct callbacks.
>
>That would be fine too... but I thought you were saying that you
>couldn't do this at all any more, because the metaclass had to be
>determined before the class, instead of inside it.

Correct.


>Note that it doesn't have to be any particular magic name -- just one
>agreed upon by the metaclass and the class author.  Today, some such
>names are semi-standardized already; you don't need language support.
>
>Why would you suddenly start needing language support after 3115?

Because it eliminated an existing magic name: __metaclass__.  Under the old 
regime, you could simply replace __metaclass__ with a function that called 
the old __metaclass__, then applied any desired decoration to the result.

A __decorators__ hook would replace this hack with something less 
convoluted, and allow method decorators and attribute descriptors a chance 
to modify the class, if needed.  (For example, the @abstractmethod could 
ensure the class was abstract, or raise an error if the class wasn't 
explicitly declared abstract.)



More information about the Python-3000 mailing list