>>> class Person(object): ... pass ... >>> class Friendly(object): ... def hello(self): ... print 'hello' ... >>> >>> Person.__bases__ += (Friendly,) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: Cannot create a consistent method resolution order (MRO) for bases object, Friendly
But it works for old-style classes: >>> class Person: ... pass ... >>> class Friendly: ... def hello(self): ... print 'hello' ... >>> >>> p = Person() >>> >>> Person.__bases__ += (Friendly,) >>> >>> p.hello() hello Python is 2.6.1. -- http://mail.python.org/mailman/listinfo/python-list