[Python-3000] PEP for Metaclasses in Python 3000
Nick Coghlan
ncoghlan at gmail.com
Tue Mar 13 13:33:10 CET 2007
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)
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-3000
mailing list