Feb-02-2024, 09:01 AM
(This post was last modified: Feb-02-2024, 09:04 AM by Gribouillis.)
(Feb-02-2024, 08:10 AM)akbarza Wrote: but still, i don't know why Python in line 22 goes to child2-form1 .That's because you read the documentation but you don't understand it.
At line 22, python will run
super(child1, self).form1()
. It means that it will search and call method form1()
in the part of the __mro__
of self
that comes after child1
. This part of the __mro__
is child2 -> parent -> object
. As there is a method named form1()
in child2
, it is this method that gets called.
« We can solve any problem by introducing an extra level of indirection »