Play with classes

Michele Simionato michele.simionato at poste.it
Thu Feb 26 18:22:22 CET 2004


Peter Otten <__peter__ at web.de> wrote in message news:<c1kmj0$28f$04$1 at news.t-online.com>...
> Trying the same thing with newstyle class resulted in a TypeError:
> 
> >>> E.__bases__ = (A, B)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: __bases__ assignment: 'A' deallocator differs from 'object'
> 

You can't do that with new style classes! I guess because of some
subtle issue with metaclasses, but I don't really know.

The OP needs "type", the custom metaclass:

UserClass=type("UserClass",(ModeA, TypeB, SubtypeB),{})


          Michele Simionato



More information about the Python-list mailing list