Ken Elkabany schrieb: > I would simply subclass 'int', but this object needs to be general enough to > pretend to be an 'int', 'NoneType', 'str', etc... A long shot: Can I change > the base class on an instance by instance basis depending on the need? Well, > now I can imagine having a class factory that will spawn for me the class > that inherits the correct base type. Any other solutions?
No, it's not possible. The type is an inherent part of an object. Python looks up methods and other attributes by looking at the type. The method call obj.method() is implemented as type(obj).method(obj). Christian -- http://mail.python.org/mailman/listinfo/python-list