[chimera-dev] SimpleSession.sesRepr()

Eric Pettersen pett at cgl.ucsf.edu
Thu Dec 20 17:13:05 PST 2007


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-dev/attachments/20071220/da3e0f15/attachment.html>


More information about the Chimera-dev mailing list