Newbie Alert: Help me store constants pythonically

Nicola Larosa nico-NoSp at m-tekNico.net
Tue Nov 8 02:39:06 EST 2005


> Also my config files have (a tiny bit of) nested
> structure, such as:
> 
> Model1(
>    numBumps = 1
>    sizeOfBumps = 2
>    transversePlanes = [
>         Plane(type=3, z=4),
>         Plane(type=5, z=6),
>         Plane(type=3, z=8)
>     ]
> )
> 
> which I'm not sure the .ini format can easily support.  I could use
> (key buzzword voice) XML, but  I fear that might send me down the
> 'overcomplicating things' path.  Your suggestion has given me some new
> places to search Google (configparser, python config files), so I'll
> look around for better ideas.

You may want to look into ConfigObj:

http://www.voidspace.org.uk/python/configobj.html#config-files

-- 
Nicola Larosa - nico-NoSp at m-tekNico.net

No inventions have really significantly eased the cognitive difficulty
of writing scalable concurrent applications and it is unlikely that any
will in the near term. [...] Most of all, threads do not help, in fact,
they make the problem worse in many cases. -- G. Lefkowitz, August 2005



More information about the Python-list mailing list