Improve the error message for impossible multiple inheritance
I sometimes get the error message: TypeError: Cannot create a consistent method resolution order (MRO) for bases … I suggest that Python report * cycles (if there are any), or * a list of orderings of direct base classes (if there are no cycles). A cycle for the base classes A, B, C, D can be reported as follows: TypeError: Cannot create a consistent method resolution order (MRO) because A inherits from B (through X, Y), but B inherits from A (through Z). The topological sort could be reported as follows for base classes A, B, C, D: TypeError: Cannot create a consistent method resolution order (MRO) because B inherit from C (through X, Y), but B follows C in inheritance order. It might be nice to have an exposed tool somewhere in the standard library that spits out for A, B, C, D: A, B inherit from C (through X, Y) C inherit from D (through Z) Best, Neil
participants (1)
-
Neil Girdhar