python find size of object code example

Example: how to get the size of an object in python

import sys
object = set()

print(sys.getsizeof(object))
##### will get 216 possibly based on version 3.9 ###

###  use different objects like list(), dict(), str(), int(), float(), etc..###
### for getting to know size of each objects and use the most appropriate ###
## particularly set and dict will seem to not change in size even after ##
## adding lots of values but they are just so huge, only use them to store ##
## large values ##