[Python-3000] pep 3124 plans

Nick Coghlan ncoghlan at gmail.com
Tue Jul 31 11:40:12 CEST 2007


Phillip J. Eby wrote:
> In other words, a class' metaclass has to be a derivative of all its 
> bases' metaclasses; ISTM that a __prepare__ namespace needs to be a 
> derivative in some sense of all its bases' __prepare__ results.  This 
> probably isn't enforceable, but the pattern should be documented such 
> that e.g. the overloading metaclass' __prepare__ would return a 
> mapping that delegates operations to the mapping returned by its 
> super()'s __prepare__, and the actual class creation would be 
> similarly chained.  PEP 3115 probably needs a section to explain 
> these issues and recommend best practices for implementing 
> __prepare__ and class creation on that basis.  I'll write something 
> up after I've thought this through some more.

A variant of the metaclass rule specific to __prepare__ might look 
something like:
   A class's metaclass providing the __prepare__ method must be a 
subclass of all of the class's base classes providing __prepare__ methods.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list