Created
February 19, 2015 19:09
-
-
Save anonymous/11d0c2e5a29b85afbbfa to your computer and use it in GitHub Desktop.
class and subclass attributes
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 Foo(object): | |
num = 1 | |
ary = [] | |
class Bar(Foo): | |
pass | |
Bar.num = 2 | |
Bar.ary.extend([1]) | |
print Bar.num | |
# 2 | |
print Foo.num | |
# 1 | |
print Bar.ary | |
# [1] | |
print Foo.ary | |
# [1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment