Want to improve this question? As written, this question is lacking some of the information it needs to be answered. If the author adds details in comments, consider editing them into the question. Once there's sufficient detail to answer, vote to reopen the question.
Closed 4 hours ago.
I'm trying to understand Python's inheritance model. This is the example I'm using:
class B:
def b_m(self):
print("B.b_m")
class A(B):
def a_m(self):
print("a.a_m")
a = A()
print(a.__class__)
print(a.__class__.__mro__)
$ python cl.py
<class '__main__.A'>
(<class '__main__.A'>, <class '__main__.B'>, <class 'object'>)
Based on the output, I've drawn the following diagram:
Can you confirm it's correct?
I'm coming from the JavaScript background, where inheritance model is a lot more cumbersome. Here's the diagram I put together to demonstrate the difference with just one class A:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4