33 lines
935 B
Plaintext
33 lines
935 B
Plaintext
children precede their parents and the order of appearance in __bases__ is respected.
|
|
|
|
why not to use super in object classes: The problem with incompatible signatures https://www.artima.com/weblogs/viewpost.jsp?thread=281127
|
|
|
|
why (swap the print and super in each command)
|
|
class First(object):
|
|
def __init__(self):
|
|
super(First, self).__init__()
|
|
print("first")
|
|
|
|
class Second(object):
|
|
def __init__(self):
|
|
super(Second, self).__init__()
|
|
print("second")
|
|
|
|
class Third(First, Second):
|
|
def __init__(self):
|
|
super(Third, self).__init__()
|
|
print("third")
|
|
|
|
Third()
|
|
print(Third.__mro__)
|
|
|
|
second
|
|
first
|
|
third
|
|
(<class '__main__.Third'>, <class '__main__.First'>, <class '__main__.Second'>, <class 'object'>)
|
|
[Finished in 0.0s]
|
|
|
|
|
|
https://www.datacamp.com/community/data-science-cheatsheets
|
|
|
|
https://www.datacamp.com/community/tutorials/decorators-python - functions returning other functions? |