Search notes:

Python: __mro__

__mro__ stands for method resolution order. It is a tuple whose elements correspond to the types from which a type is derived (and hence, this dunder is found in type objects).
class A: pass
class B: pass

class C(A, B): pass

print(A.__mro__)
#
#  (<class '__main__.A'>, <class 'object'>)

print(B.__mro__)
#
#  (<class '__main__.B'>, <class 'object'>)

print(C.__mro__)
#
#  (<class '__main__.C'>, <class '__main__.A'>, <class '__main__.B'>, <class 'object'>)

a = A()
b = B()
c = C()

assert not hasattr(a, '__mro__')
assert not hasattr(b, '__mro__')
assert not hasattr(c, '__mro__')
Github repository about-Python, path: /dunders/__mro__/demo.py

See also

multiple inheritance
The built-in function type().
Other dunders (such as __bases__ which returns a class's immediate super classes).

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758199461, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/dunders/__mro__(70): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78