List,
I've been messing with metaclasses. I thought I understood them until I ran
into this. (See code below.) I was expecting the generated class, 'Foo' to have
an 'x' class-level attribute, as forced upon it by the metaclass 'DracoMeta'
at creation. Unfortunately, it doesn't and I don't know why
Modulok wrote:
> List,
>
> I've been messing with metaclasses. I thought I understood them until I
> ran into this. (See code below.) I was expecting the generated class,
> 'Foo' to have an 'x' class-level attribute, as forced upon it by the
> metaclass 'DracoMeta' at creation. Unfortunately, it
Peter,
>> ... the class, i. e. the instance of the metaclass with all its attributes
>> has already been created by the type.__new__() method. If you move the
>> manipulation of the members dict into a custom __new__() method you get
>> the desired behaviour...
Thank you! You've solved my problem