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

Phillip J. Eby pje at telecommunity.com
Tue May 1 02:03:58 CEST 2007


At 07:29 PM 4/30/2007 -0400, Jim Jewett wrote:
>On 4/30/07, Phillip J. Eby <pje at telecommunity.com> wrote:
>
>>It is currently an open issue to determine the best way to implement
>>this rule in Python 3.0.  Under Python 2.x, a class' metaclass was
>>not chosen until the end of the class body, which means that
>>decorators could insert a custom metaclass to do processing of this
>>sort.  (This is how RuleDispatch, for example, implements the implicit
>>class rule.)
>
>>PEP 3115, however, requires that a class' metaclass be determined
>>*before* the class body has executed, making it impossible to use this
>>technique for class decoration any more.
>
>It doesn't say what that metaclass has to do, though.
>
>Is there any reason the metaclass couldn't delegate differently
>depending on the value of __my_magic_attribute__ ?

Sure -- that's what I suggested in the "super(), class decorators, and PEP 
3115" thread, but Guido voted -1 on adding such a magic attribute to PEP 
3115.  (Actually, I think he -1'd *any* change to 3115 to support this 
feature.)



More information about the Python-3000 mailing list