Given a class Foo (whether it is a new-style class or not), how do you generate all the base classes - anywhere in the inheritance hierarchy -
Although Jochen's answer is very helpful and correct, as you can obtain the class hierarchy using the .getmro() method of the inspect module, it's also important to highlight that Python's inheritance hierarchy is as follows:
ex:
class MyClass(YourClass):
An inheriting class
ex:
class YourClass(Object):
An inherited class
One class can inherit from another - The class' attributed are inherited - in particular, its methods are inherited - this means that instances of an inheriting (child) class can access attributed of the inherited (parent) class
instance -> class -> then inherited classes
using
import inspect
inspect.getmro(MyClass)
will show you the hierarchy, within Python.