Created
June 27, 2012 07:08
-
-
Save eskerda/3002163 to your computer and use it in GitHub Desktop.
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 Base(object): | |
things = [] | |
def update(self): | |
print "I do nothing" | |
class A(Base): | |
def update(self): | |
self.things.append('This is A') | |
class B(Base): | |
def update(self): | |
self.things.append('This is B') | |
a = A() | |
b = B() | |
a.update() | |
a.update() | |
a.update() | |
a.update() | |
a.update() | |
print "A things are: %s" % a.things | |
print "B thigs are: %s" % b.things | |
""" | |
OUTPUT | |
python2.7 wtf.py | |
A things are: ['This is A', 'This is A', 'This is A', 'This is A', 'This is A'] | |
B thigs are: ['This is A', 'This is A', 'This is A', 'This is A', 'This is A' | |
Why does B have things?? | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment