Skip to content

Instantly share code, notes, and snippets.

@rdammkoehler
Created January 7, 2016 16:09
Show Gist options
  • Save rdammkoehler/4c68d2a1ba13be4caa00 to your computer and use it in GitHub Desktop.
Save rdammkoehler/4c68d2a1ba13be4caa00 to your computer and use it in GitHub Desktop.
Don't do this
class Foo(object):
@classmethod
def bar(cls,x):
cls.x = x
def p(self):
print self.x
a = Foo()
a.bar(1)
a.p() # 1
b = Foo()
b.bar(2)
b.p() # 2
a.p() # 2, not what we wanted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment