From: Gael V. <gae...@no...> - 2007-12-13 11:15:49
|
On Thu, Dec 13, 2007 at 09:30:44AM +0100, Gael Varoquaux wrote: > On Wed, Dec 12, 2007 at 06:39:02PM -0700, Fernando Perez wrote: > > On second thought though: __str__ is the one meant for 'human > > consumption', while __repr__ is deliberately meant to be much more > > machine-like. Basically the idea is that, whenever possible, one can > > do > > x == eval(repr(x)) > > That is true for many of the builtin data types of the language. > I totally agree. However if a user types: > pylab.rcParams > in IPython, or the Python interpreter, she gets the repr, AFAIK. I would > like this display to be readable. OK, this is what I currently have: """ In [1]: import simpleconf In [2]: simpleconf.SimpleConfig() Out[2]: datafile = 'data.txt' # a value of type 'str' or a value of type 'unicode' solver = 'Direct' # 'Direct' or 'Iterative' Protocol.max_users = 1 # a value of type 'int' Protocol.ptype = 'http' # 'http' or 'ftp' or 'ssh' """ I would like to make it as easy as possible for users to understand how to modify configuration options. Comments are welcomed. Gaël |