Skip to content

Instantly share code, notes, and snippets.

@kgaughan
Last active July 28, 2017 15:10
Show Gist options
  • Save kgaughan/87e2d67769cdae4993319f425afc9983 to your computer and use it in GitHub Desktop.
Save kgaughan/87e2d67769cdae4993319f425afc9983 to your computer and use it in GitHub Desktop.
% python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class A(object):
... pass
...
>>> a = A()
>>> a.__class__.__dict__ is a.__class__.__dict__
False
>>> id(a.__class__.__dict__) == id(a.__class__.__dict__)
True
>>> a1 = id(a.__class__.__dict__)
>>> a2 = id(a.__class__.__dict__)
>>> print a1, a2
4497119336 4497119336
>>> id(a.__class__.__dict__)
4497119392
>>> id(a.__class__.__dict__)
4497119392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment