Created
October 24, 2010 13:32
-
-
Save lqc/643536 to your computer and use it in GitHub Desktop.
Python 2.x super() is broken :(
This file contains 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 method(self): | |
return "A" | |
class B(A): | |
def method(self): | |
return "B" + super(B, self).method() | |
class C(B): | |
pass | |
x = C() | |
print(x.method()) | |
B = C # this is what a class decorator with subclassing does - it assings a sublass to the base class' name | |
print(x.method()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment