Skip to content

Instantly share code, notes, and snippets.

@lqc
Created October 24, 2010 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lqc/643536 to your computer and use it in GitHub Desktop.
Save lqc/643536 to your computer and use it in GitHub Desktop.
Python 2.x super() is broken :(
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