Last active
August 29, 2015 14:05
-
-
Save sneeu/23e26a938b14417ad057 to your computer and use it in GitHub Desktop.
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 A(object): | |
| ... def __init__(self, a): | |
| ... self.a = a | |
| ... @classmethod | |
| ... def f(cls, a): | |
| ... return cls(a) | |
| ... | |
| >>> class B(A): | |
| ... def __init__(self, a, b): | |
| ... super(B, self).__init__(a) | |
| ... self.b = b | |
| ... | |
| >>> A.f(2) | |
| <__main__.A object at 0x100cf5450> | |
| >>> B.f(3) | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| File "<stdin>", line 6, in f | |
| TypeError: __init__() takes exactly 3 arguments (2 given) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment