Skip to content

Instantly share code, notes, and snippets.

@borogove
Last active August 29, 2015 14:09
Show Gist options
  • Save borogove/0ab65f340dce95ac72a4 to your computer and use it in GitHub Desktop.
Save borogove/0ab65f340dce95ac72a4 to your computer and use it in GitHub Desktop.
>>> class A(object):
... def __init__(self):
... pass
...
>>> class B(A):
... x = 1
...
>>> g = B()
>>> g.__dict__
{}
>>> B.__dict__
dict_proxy({'x': 1, '__module__': '__main__', '__doc__': None})
# but lookups check instance, then class:
>>> g.x
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment