ion-python icon indicating copy to clipboard operation
ion-python copied to clipboard

Add `__str()__`/`__repr()__` Implementation to `IonPyDict`

Open jamesdbowman opened this issue 6 years ago • 0 comments

Issue

IonPyDict does not have a nice string representation when printed to the console, e.g. I currently the following output:

<amazon.ion.simple_types._ion_type_for.<locals>.IonPyValueType object at 0x100947cc0>

when running this sample code:

import io
import amazon.ion.simpleion as ion

myobj = {'StrKey': 'StrValue', 'IntKey': 123}
fp = io.BytesIO()
ion.dump(myobj, fp)
ion_dict = ion.load(io.BytesIO(fp.getvalue()))
print(ion_dict)

Expected Behavior

Similar output to printing the native Python dict directly, e.g.:

{'StrKey': 'StrValue', 'IntKey': 123}

jamesdbowman avatar May 22 '19 01:05 jamesdbowman