__bases__ doesn't work! What's next?
The following code doesn't work in Python 3.x, but it used to work with old-style classes: class Extender: def extension(self): print("Some work...") class Base: pass Base.__bases__ += (Extender,) Base().extension() Question is simple: How can I add dynamically (at runtime) a super class to a class in Python 3.x? But I'm ready the answer will be hard! ) Mykola Kharechko As for me it is impossible. But you can create new class dynamically: class Extender(object): def extension(self): print("Some work...") class Base(object): pass Base = type('Base', (Base, Extender, object), {}) Base()