[Python-3000] PEP for Metaclasses in Python 3000

Phillip J. Eby pje at telecommunity.com
Tue Mar 13 17:06:55 CET 2007


At 10:33 PM 3/13/2007 +1000, Nick Coghlan wrote:
>Greg Ewing wrote:
> > If they're passed to both, then the signatures become
> >
> >    metaclass.__prepare__(name, bases, **kwargs)
> >    metaclass(name, bases, body, **kwargs)
> >
> > BTW, I don't think I like the name "__prepare__" much
> > more than "__metacreate__". It seems just as wooly.
> > What's being prepared? How? What for?
>
>__namespace__ and __instancedict__ are the most literally descriptive
>names that have occurred to me (after all, the role of the method is to
>return the locals() dictionary for the creation of a class).
>
>That said, __new__ & __init__ could also be said to be somewhat woolly
>if you didn't already know what they did - preparing a namespace for
>evaluation of a class body shouldn't be hard to remember once someone
>has learned what the term is referring to.
>
>If Guido decides he likes __prepare__, I can certainly live with it :)
>(I actually quite like the connotation that what the method returns has
>been prepared for something, but isn't really finished yet)

How about __class_locals__()?  This would at least say exactly what the 
return value is used for.



More information about the Python-3000 mailing list