Is there a way that I can pragmatically determine, either at runtime, or via static analysis, the method resolution order for a given python class?
Imagine I have a set of classes
class A():
...
class B(A):
...
class C(A):
...
class D(B, C):
def print_mro(self):
print("D, B, C, A")
I want to find out the C3 linearization for them is without having to root through the source code and try to determine the order by hand. I'm working on a django app where the views have lots of mixins that have been up to now rather haphazardly ordered. I need to make sure that they are in the right order though, and for security reasons I don't want to check my work by hand and risk a data leak. I also don't want to go through by hand and add a print statement to every mixin's dispatch method.