Keepin constants, configuration values, etc. in Python - dedicated module or what?

Dave Angel d at davea.name
Thu Oct 2 14:50:17 EDT 2014


On 09/30/2014 10:55 AM, cl at isbd.net wrote:
> Dave Angel <davea at davea.name> wrote:
 >>   ....
>>   name. And presumably you never remove an old name from the
>>   config.
>>
> The only things really likely to change (and may change regularly) are
> the conversion factors, drifting voltage references etc. will
> inevitably require these to be recalibrated every so often.  Other
> than that it's just typos or me deciding to change the name of
> something.
>

Right there you have an important design decision.  You then presumably 
have to have a way that each particular data point can record what 
configuration it's associated with. If you just change the calibration 
data externally, then all the old records are invalidated.

>
>> More troublesome is adding a new kind of data. You have to decide
>>   whether it's worth generalizing the code to anticipate the
>>   change,  or just admit that the code will grow at that point and
>>   that old code won't deal with the new data.
>>
> There's a separate module for each input type (just ADC and 1-wire at
> the moment), I don't anticipate any more though I suppose there might
> be digital inputs one day.  So a configuration [file] for each type
> seems to make sense, generalising it would be more trouble than it's
> worth I think.
>
>



-- 
DaveA



More information about the Python-list mailing list