Created
November 19, 2017 06:04
-
-
Save KelSolaar/9ab183c12bbd00c7d03d768c215c4030 to your computer and use it in GitHub Desktop.
Object Inherit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %% | |
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