Quick actions

cmd+k|ctrl+k

Navigation

Languages

super()_in_python3

Snippet info

Language

Python

Visibility

public

Author

rednik96

Created

2017-11-15T09:09:06Z

Updated

2017-11-16T10:36:41Z

# In python 3 super goes up the mro and makes the next possible call
# in this case A.test() calls C.test()

class A:
    def test(self):
        print('A')
        super().test()


class B:
    pass


class C:
    def test(self):
        print('C')
        # super().test()


class D(A, B, C):
    pass


print(D.__mro__)
D().test()
INFO