GNOME Bugzilla – Bug 660320
pretty print for dict and list
Last modified: 2018-07-10 22:05:44 UTC
[ Originally filed by Olivier Lê Thanh Duong as http://www.reinteract.org/trac/ticket/79 ] It would be nice to have a pretty print for dict and list like ipython does 04/02/09 14:13:46 changed by akaihola ===================================== pprint.pformat() or pprint.pprint() might be useful for this. 04/02/09 17:45:30 changed by otaylor ==================================== I'd appreciate more detail about what is desired here - Reinteract already does something along the lines of pprint.format - see: http://git.fishsoup.net/cgit/reinteract/tree/lib/reinteract/data_format.py For very big lists and multi-dimension numpy arrays, you could imagine using a scrolling widget rather than dumping out a text representation, but obviously that's something that neither ipython nor pprint does. 04/04/09 11:38:39 changed by akaihola ===================================== I assume olethanh would like Reinteract to do such formatting by default. Here's an example of what IPython does: In [1]: range(25) Out[1]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24] In [2]: dict.fromkeys(range(25)) Out[2]: {0: None, 1: None, 2: None, 3: None, 4: None, 5: None, 6: None, 7: None, 8: None, 9: None, 10: None, 11: None, 12: None, 13: None, 14: None, 15: None, 16: None, 17: None, 18: None, 19: None, 20: None, 21: None, 22: None, 23: None, 24: None} Here's a worksheet for testing what Reinteract outputs by default and with data_format.format() plus pprint() output as a comparison: from reinteract.data_format import format from pprint import pprint range(25) dict.fromkeys(range(25)) print format(range(25)) print format(dict.fromkeys(range(25))) pprint(range(25)) pprint(dict.fromkeys(range(25))) 04/04/09 15:21:40 changed by olethanh ===================================== Yes I was thinking about having this behaviour by default. The manual way isn't easily discoverable and doing it each time you want to see the value of a variable seems a bit tedious.
Reinteract is not under active development anymore and had its last code changes in early 2012: http://git.fishsoup.net/cgit/reinteract/log/ Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as GNOME Bugzilla is deprecated) if anyone takes the responsibility for active development again.