
Chris Angelico writes:
It's a very real problem in C++, because C++ has a completely different concept of multiple inheritance.
Then what's the solution to the diamond problem in python? in this example : ``` class HighGobelin: def scream(self): print("raAaaaAar") class CorruptedGobelin(HighGobelin): def scream(self): print("my corrupted soul makes me wanna scream") super().scream() class ProudGobelin(HighGobelin): def scream(self): print("I ... can't ... contain my scream!") super().scream() class HalfBreed(ProudGobelin, CorrupteGobelin): def scream(self): if random.choices([True, False]): super(HalfBreed, self).scream() else: super(ProudGobelin, self).scream() ``` You want calls to ProudGobelin scream method to visit ProudGobelin, then HighGobelin Not ProudGobelin, then CorruptedGobelin, then HighGobelin. If your solution is to revert back to the class.method syntax, you're again denying the proxy feature, the dependency injection use case, and the sideway specialisation (which to be fair is something we explicitely don't want here). Mocking only HighGobelin through the dependency injection of super and MRO is not possible unless you can provide a solution for this case with super. class.method is then an incomplete solution.