Skip to content

Instantly share code, notes, and snippets.

@dripolles
Created July 10, 2012 09:52
Show Gist options
  • Save dripolles/3082387 to your computer and use it in GitHub Desktop.
Save dripolles/3082387 to your computer and use it in GitHub Desktop.
simple example of Python MRO and class attributes
In [1]: class A(object):
...: x = [1,2,3]
...:
In [2]: class B(A): pass
...:
In [3]: b = B()
In [4]: b.x.append(33)
In [5]: A.x
Out[5]: [1, 2, 3, 33]
In [6]: b.x = 'asdasd'
In [7]: A.x
Out[7]: [1, 2, 3, 33]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment