
On 3/26/22 12:04, Ethan Furman wrote:
On 3/26/22 09:57, malmiteria wrote:
The core of what i wanna discuss here is that i don't think mro and super (mainly because it relies on mro) are very pythonic. Mainly that some behaviors of the mro are too implicit, and are silencing what really should be errors.
[...] In other words, subclassing is a very tight coupling of code, and you had better know the classes you are inheriting from to get it right -- and that part is the programmer's responsibility, not Python's.
To add to that, you can write your custom metaclass, or even (and more easily) a class decorator, that goes through the mro and raises an exception if there are any duplicate methods in previous classes that have not been overridden in the new class. -- ~Ethan~