If you convert an object/list to string with ascii and than back with eval you get the same representation with same bytes size.
Why ast.literal_eval give back an object with different size?
a = [{"a": {"b": False}, True: 1}, 2, (3,6), ('g',),{"jfg"}]
b = ascii(a)
c = eval(b)
d = ast.literal_eval(b)
print(f"a: {sys.getsizeof(a)}\t{type(a)}\t{a}\nb: {sys.getsizeof(b)}\t{type(b)}\t{b}\nc: {sys.getsizeof(c)}\t{type(c)}\t{c}\nd: {sys.getsizeof(d)}\t{type(d)}\t{d}")
a: 96 <class 'list'> [{'a': {'b': False}, True: 1}, 2, (3, 6), ('g',), {'jfg'}]
b: 107 <class 'str'> [{'a': {'b': False}, True: 1}, 2, (3, 6), ('g',), {'jfg'}]
c: 96 <class 'list'> [{'a': {'b': False}, True: 1}, 2, (3, 6), ('g',), {'jfg'}]
d: 120 <class 'list'> [{'a': {'b': False}, True: 1}, 2, (3, 6), ('g',), {'jfg'}]
Which is the better/safer/faster/lighter way to convert an object to string and back?