Class variable inheritance
Lie Ryan
lie.1296 at gmail.com
Wed Sep 16 07:15:33 EDT 2009
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.
More information about the Python-list
mailing list