
Hi all, For anyone saving data into session files, I've implemented a sesRepr () function for use in place of repr() for large data objects (ones whose repr() would be hundreds or thousands of characters). sesRepr () inserts newlines periodically [where possible] so that the resulting session file has a better chance of being viewable in an editor or sent through various mailers without corruption. sesRepr() will also frequently make the representation smaller despite the additional newlines since it passes float values through the "%g" format which will often trim their representation by half a dozen characters or so. I thought pprint.pformat() would do the job but it adds a _lot_ of whitespace to the repr if there are nested compound objects (e.g. a dictionary whose values are lists). You access sesRepr() (as of tomorrow's daily build) with: from SimpleSession import sesRepr --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
participants (1)
-
Eric Pettersen