On Thursday 13 December 2007 04:24:21 am Gael Varoquaux wrote: > 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.
It is possible to save the current settings to a file, so only those that deviate from the default are written to the file. By putting the comments on the same line as the data, you encourage users to comment their config files accordingly, but comments appearing on the same line as the data will be deleted if the current settings are saved. Also, what happens when the comment is many lines long, like the comment for matplotlib's timezone setting? I have a feeling there are formatting issues with this scheme. I think I prefer the existing behavior, where the comment appears on a seperate line just before the data. Maybe I don't understand the point of your modifications. Darren ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel