Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import sys
  2. import decimal
  3.  
  4. # Reference for the memory size of Python data structure
  5. d = {
  6. "int": 0,
  7. "float": 0.0,
  8. "dict": dict(),
  9. "set": set(),
  10. "tuple": tuple(),
  11. "list": list(),
  12. "str": "a",
  13. "unicode": u"a",
  14. "decimal": decimal.Decimal(0),
  15. "object": object(),
  16. }
  17. for k, v in sorted(d.items()):
  18. # Return the size of object in bytes >>>
  19. print(k, sys.getsizeof(v))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement