About __mro__ method

I want to know that why the output of B.mro is coming

O/P - (<class ‘main.B’>, <class ‘main.A’>, <class ‘object’>)

Hey @iamadi121, so the rule says that all the child nodes should have been visited before going on to the parent node. Same is the case over here. If there is any method being searched for, we will first look in class B and then we will move onto class A. I would recommend you to watch the video again if you have doubts regarding the concept.

I hope this helps !
Please mark the doubt as resolved in your doubts section ! :smile:
Happy Learning ! :+1:

Thanks
but while traversing from Node B how can we go to Node A if all the child Node of A in not traversed…
like in case of Node B… child node of A i.e. Node C is still left…

Hey you are right but u need to keep one thing in mind that while talking about B, we will not look at the whole cycle. We are just concerned with B and it’s parent class A. B does not know that there is another child of A (i.e. C) present. Similarily you would observe same is the case for class C. When you call class C, then it does not have to go and traverse class B. But when it comes to class E, you have to take care of the complete cycle as E inherits from both class B and D.

I hope this helps ! :+1:
Happy Learning ! :smile:

now I got it… Thankyou… jnj jnj jkj kk v

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.