Skip to content

Instantly share code, notes, and snippets.

@ishashankkumar
Last active November 16, 2019 09:47
Show Gist options
  • Save ishashankkumar/b78dd354a809a75fcf598b729abf9f62 to your computer and use it in GitHub Desktop.
Save ishashankkumar/b78dd354a809a75fcf598b729abf9f62 to your computer and use it in GitHub Desktop.
# Assigning variable names to simple object types
>>> a,b,c,d,e,f = None, 1, 1.5, 2**63, 'a', 7561348975613048756103487563847561934857613048756139485712345678907
# Printing the size of these objects in memory
>>> a.__sizeof__(), b.__sizeof__(), c.__sizeof__(), d.__sizeof__(), e.__sizeof__(), f.__sizeof__()
(16, 24, 24, 36, 38, 56)
#lists, tuples, dictionary.
>>> l1, l2 = [], [1,2,3,4] #Lists
>>> l1.__sizeof__(), l2.__sizeof__()
(40, 72)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment