Created
June 4, 2012 09:50
-
-
Save Lothiraldan/2867535 to your computer and use it in GitHub Desktop.
Super property/attribute access
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): | |
class_attribute = 1 | |
def __init__(self): | |
self.instance_attribute = 2 | |
class B(A): | |
def test1(self): | |
print super(B, self).class_attribute | |
def test2(self): | |
print super(B, self).instance_attribute | |
b = B() | |
b.test1() | |
b.test2() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment