Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created November 19, 2017 06:04
Show Gist options
  • Save KelSolaar/9ab183c12bbd00c7d03d768c215c4030 to your computer and use it in GitHub Desktop.
Save KelSolaar/9ab183c12bbd00c7d03d768c215c4030 to your computer and use it in GitHub Desktop.
Object Inherit
# %%
class Foo():
def __init__(self):
print('Foo')
class Bar(Foo):
def __init__(self):
super(Bar, self).__init__()
print('Bar')
try:
Bar()
except TypeError as error:
print(error)
class Foo2(object):
def __init__(self):
print('Foo2')
class Bar2(Foo2):
def __init__(self):
super(Bar2, self).__init__()
print('Bar2')
Bar2()
"""
super() argument 1 must be type, not classobj
Foo2
Bar2
<__main__.Bar2 at 0x10a89ec90>
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment