I have a class which matches a schema.
class EnvelopeData(object):
def __init__(self):
self.envelope_data = OrderedDict()
self.table = table_name
self.payload = payload
def get_envelope_data(self, use_hex_encoding):
"""
Getting the envelope data to be sent with the actual record payload
:param use_hex_encoding:
:raise:
"""
self.envelope_data["table"] = self.table.encode(STRING_ENCODING)
self.envelope_data["payload"] = Utility.get_serialized_avro(self.table,
hex_encoding=use_hex_encoding)
print "For schema_name ", self.schema, sys.getsizeof(self.envelope_data["table"])+sys.getsizeof(self.envelope_data["payload"])
and also when I print
a = EnvelopeData()
a.get_envelope_data()
print sys.getsizeof(a.envelope_data)
The size of the elements inside > size of the ordereddict that contains the element. So, I`m confused as to how a dict can take lesser spaces then its constituting element.