Skip to content

Instantly share code, notes, and snippets.

@cleder
Created February 12, 2021 04:21
Show Gist options
  • Save cleder/d2b3b16cedde023afcc7747080e96f9a to your computer and use it in GitHub Desktop.
Save cleder/d2b3b16cedde023afcc7747080e96f9a to your computer and use it in GitHub Desktop.
inheritance
class Foo:
def __init__(self):
print('Foo')
class Bar:
def __init__(self):
print('bar')
class Test(Foo, Bar):
pass
t = Test()
@cleder
Copy link
Author

cleder commented Feb 12, 2021

The super() method will be called from left to right, the first super class that provides the method wins.

Other languages may call super methods of all super classes, or overwrite on construction so that the last class that provides the method wins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment