Terry Reedy wrote:
Lie Ryan wrote:


Note that when the python interpreter meets this statement:

class B(P):
    def foo(self):
        print('ab')
    X = 'f'

the compiler sees a class statement -> create a new blank class
                                    -> assign P as the new class' parent

No, it saves the name 'B' and bases tuple P, and create a new *dict*, call it d here though it is anonymous as far as the class body is concerned.

Neat, I'd never thought that it creates the ".__dict__" before the class itself.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to