brennv / namedtupled

Lightweight namedtuple wrapper for attribute-style data access (a la JavaScript objects).
MIT License
49 stars 11 forks source link

Print contents pretty #23

Open jrwrigh opened 6 years ago

jrwrigh commented 6 years ago

It'd be nice to have __dict__() to be able to list out all the keys and values. That or it print out the contents in a json-like format

jrwrigh commented 6 years ago

There are actually instructions for how to reset the __str__ in the python documentation for namedtuples. Basically you create a class that has the namedtuple as a subclass, then modify that classes __str__ function. As to how to do that recursively, I'm not sure.