Re: Newbie Alert: Help me store constants pythonically

2005-11-08 Thread Brendan
Thanks for all the suggestions everyone. After a bit of googling on the c.l.p. group, I see that building config files is one of those 'Everyone has a favourite way of doing it' types of problems, with lots of reimplementations. I should change the thread topic to Yet Another Config File

Re: Newbie Alert: Help me store constants pythonically

2005-11-08 Thread Stefan Rank
on 08.11.2005 17:40 Brendan said the following: [snip config/properties file needs] I've checked out ConfigParser, ConfigObj, Pickle, PyYaml and gnossis.xml.serialize, and none meet all the above criteria (though they're all neat). So I've decide to use ...drumroll please plistlib (

Re: Newbie Alert: Help me store constants pythonically

2005-11-07 Thread Brendan
How many is LOOONG? Ten? Twenty? One hundred? About 50 per Model If it is closer to 100 than to 10, I would suggest putting your constants into something like an INI file: [MODEL1] # or something more meaningful numBumps: 1 sizeOfBumps: 99 [MODEL2] numBumps: 57 sizeOfBumps: 245

Re: Newbie Alert: Help me store constants pythonically

2005-11-07 Thread Jorge Godoy
Brendan [EMAIL PROTECTED] writes: seems risky. 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

Re: Newbie Alert: Help me store constants pythonically

2005-11-07 Thread Ron Adam
Brendan wrote: How many is LOOONG? Ten? Twenty? One hundred? About 50 per Model If it is closer to 100 than to 10, I would suggest putting your constants into something like an INI file: [MODEL1] # or something more meaningful numBumps: 1 sizeOfBumps: 99 [MODEL2] numBumps: 57

Re: Newbie Alert: Help me store constants pythonically

2005-11-07 Thread Steven D'Aprano
Brendan wrote: Thanks for your reply Steve. I like this suggestion because it separates my config data from the code, which could mean less headaches editing the values later. It also lets me keep my constants language-neutral, which is good because I haven't convinced my boss yet that

Re: Newbie Alert: Help me store constants pythonically

2005-11-07 Thread Nicola Larosa
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.

Newbie Alert: Help me store constants pythonically

2005-11-06 Thread Brendan
Hi all I'm new to Python (and programming in general), and I can't decide what is the most 'pythonic' way to approach a problem. Your advice would be appreciated. I have a bunch of 'scans', containing the data measured from one of several types of 'model'. Each 'model' has different values for

Re: Newbie Alert: Help me store constants pythonically

2005-11-06 Thread Francesco Bochicchio
Il Sun, 06 Nov 2005 08:33:17 -0800, Brendan ha scritto: Hi all I'm new to Python (and programming in general), and I can't decide what is the most 'pythonic' way to approach a problem. Your advice would be appreciated. I have a bunch of 'scans', containing the data measured from one of

Re: Newbie Alert: Help me store constants pythonically

2005-11-06 Thread Brendan
Thanks for the vote FB. The reason I'm using that method for assigning instance attributes is that the argument list for __init__ is LOOONG. (There are many constants, I only gave two for the examples). I wanted to avoid typing them out twice. --

Re: Newbie Alert: Help me store constants pythonically

2005-11-06 Thread Steven D'Aprano
Brendan wrote: Hi all I'm new to Python (and programming in general), and I can't decide what is the most 'pythonic' way to approach a problem. Your advice would be appreciated. I have a bunch of 'scans', containing the data measured from one of several types of 'model'. Each 'model'