Efficient configuration storage
Alexis Roda
alexis.roda at urv.es
Wed Sep 22 12:32:58 EDT 2004
sebsauvage wrote:
>
> ConfigParser could do the trick, but the biggest trouble is that it does
> not retain type (boolean, integer, string...).
>
> Would I have to store everything as text and cast it everywhere
> it's used (and try/except each cast of course) ?
> 'Looks ugly and inefficient to me.
ConfigParser has methods get_bool, get_int (can't remember the exact
name) ...
> Or have a configuration class which knows the type of each parameter
> and casts appropriately from the configuration file ?
Well, here the cast may fail, so you should catch exception/errors too.
HTH
--
////
(@ @)
----------------------------oOO----(_)----OOo--------------------------
<> Ojo por ojo y el mundo acabara ciego
/\ Alexis Roda - Universitat Rovira i Virgili - Reus, Tarragona (Spain)
-----------------------------------------------------------------------
More information about the Python-list
mailing list