[Python-Dev] ConfigParser shootout, preliminary entry

Carlos Ribeiro carribeiro at gmail.com
Mon Oct 18 20:22:47 EDT 2004


On Mon, 18 Oct 2004 22:43:16 GMT, Bengt Richter <bokr at oz.net> wrote:
> Has anyone discussed using the csv module as the basic file interface for config data?

I believe that CSV files are better suited for regular, table-like
information, not for the type of data that is normally stored on INI
files.
 
> Windows sort of migrated away from actual .INI files to using the registry, and a
> registry entry with the name of a real ini file can divert apparent operations on
> the file to operations on the registry (for windows apps using the windows API).

The registry is a terrible way to store config information IMHO. It's
big, unwieldy, confusing and slow. Even a fast machine has a hard time
findind information inside it, and it's no wonder that it's so easy to
hide virus or spyware entries there. The fact that it is a single file
(two, in fact, but you got the idea), and that it may be used at any
time for system-level operations make simple operations as backups
unneededly dangerous.

My experience with the registry is based on the behavior of Win98;
situation may have improved in newer versions but I sincerely doubt
it. In Win98, if you want to make a reversible change to a small
section of the registry, the easy way is to make a copy of the entire
file; however, to restore this backup may leave your system with
incorrect registry information from other sections that may have
changed in the meantime. The 'right way to do it' involves a cut &
paste of the textual representation of the entries being modified, but
this is not obvious, practical, or easy to do.

> Order does matter in M$ view of INI files. IOW you _can_ (advisability of using ini
> sections that way in another thing ;-) retrieve multiple sym value info from a section
> such as
> 
> [section]
> sym=value1
> sym=value2

I'm aware of that, and that was one of the design issues from the very
beginning. My intention is to convert these values to Python lists
upon reading, and to declare them as lists in the class statement:

class section(IniSection):
    symlst = TypeAttribute([value1, value2])

A few extra keyword parameters for the TypedAttribute may be helpful
to set typed checking behavior when reading list entries, but this is
still being thought out.

> Basic usage is simple and ok, but a clean general info repository it is not, IMO.

Thats the point -- it's not supposed to be a general repository, as is
the case with the Windows registry. Each application can keep its own
config file using a simple and readable representation, using the file
system (which is already a very good 'general repository') and
standard text files.

----
p.s. It seems to me that entire reasoning behind the Windows registry
was to allow to provide the OS with a central control hook as far as
access to configuration information was concerned. In this regard, the
registry is a failed experiment -- just look at how easy is for any
piece of junkware to use it to store their own information.

-- 
Carlos Ribeiro
Consultoria em Projetos
blog: http://rascunhosrotos.blogspot.com
blog: http://pythonnotes.blogspot.com
mail: carribeiro at gmail.com
mail: carribeiro at yahoo.com



More information about the Python-list mailing list