[Python-Dev] bugs in stdlib

Fred L. Drake, Jr. fdrake@acm.org
Tue, 31 Dec 2002 11:31:47 -0500


Guido van Rossum writes:
 > I'll leave the decision to revert your checkin to Fred, who knows the
 > code (and has pending changes to it of his own, which now cause
 > conflicts).

The conflict was minor; Eric managed to add a blank line at the end of
the file, and I'd made adjustments to the exception being raised
there.

Regarding Eric's changes, I'd like to see them discussed before being
made part of the library; the interface seems quite ad hoc, and it's
not clear that they are the right way to go about adding sequence
support.

What I've seen for sequences in INI files in the past is something
like this (working from memory):

  [SomeSection]
  NumPathEntries=3
  PathEntry1=c:\path\one
  PathEntry2=c:\path\two
  PathEntry3=c:\path\three

(I'm not advocating that as the "right" way to do it, I'm just noting
that what I've seen in practice is very different from the solution
Eric implemented.)

The value of having __str__() return a parsable INI file is highly
questionable; the motivation should be explained and discussed.  The
issue of ordering sections and options in the same way as the input
seems unimportant as well; comments are lost anyway.  Being able to
surgically edit a config file using the ConfigParser module is simply
not a supported use case.  (I wrote a module once that did support
surgical editing, and it was a royal pain!  Long lost in a disk
crash.)

I'll be reverting the change shortly.  Eric, I would like to encourage
you to pursue this functionality via discussion on python-dev with the
patch submitted via SourceForge.  The functional extensions are not
unwelcome by any means.

NB: For a very different approach to handling configuration, there's
something in Zope's CVS called "ZConfig".  Of particular interest is
the development branch that includes support for configuration schema:

http://cvs.zope.org/Packages/ZConfig/?only_with_tag=zconfig-schema-devel-branch

BTW, I'm back on python-dev now, but it's still a good idea to CC
things that need my specific attention.


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation