[Python-3000] Metaclasses in Py3K

Phillip J. Eby pje at telecommunity.com
Tue Dec 12 20:17:15 CET 2006


At 11:07 AM 12/12/2006 -0800, Thomas Wouters wrote:
>I do wonder why classes don't use fast locals, though.

Because fast locals were an optimization added for functions.  Before that, 
there was no such thing as fast locals: everything used dictionaries.


>Building the locals dict from the fast locals at the end of the class 
>suite execution seems more logical to me than what happens now...

Well, code that does things like this:

     def some_func(an_ob, whatever):
         ...


     class Foo:
         some_func = some_func


Wouldn't work any more if you switched to fast locals.  Whether you 
consider that a good thing or a bad thing depends on your perspective, I 
suppose.  Some people complain that the above pattern doesn't work in 
functions, due to the existence of fast locals.  (I'm not one of them, 
however.)



More information about the Python-3000 mailing list