On 7/3/23 12:13, Mats Wichmann via Python-list wrote:

To natter on a bit, and possibly muddy the waters even further...

Now, as I see it, from the super()'s point of view, there are two
inheritance chains, one starting at Left and the other at Right. But
*Right.__init__()* is called twice.
No: each class has just a single inheritance chain, built up when the class object is constructed, to avoid going insane. Yes, the chain for Left and for Right are different, but you're not instantiating *either* of those classes when you make a Bottom, so they don't matter here. You're just filling out a Bottom: it looks for init, finds it, and so would stop hunting - but then the super() call there sends it to the next class object in the chain to look for the method you told it to (also init), where it would stop since it found it, except you sent it on with another super(), and so on. Python is a bit... different :) (compared to other languages with class definitions)

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to