Class or Dictionary?
Andrea Crotti
andrea.crotti.0 at gmail.com
Fri Feb 11 13:23:36 EST 2011
Il giorno 11/feb/2011, alle ore 17.01, Martin De Kauwe ha scritto:
>
> i have a number some are smaller, for example switch/control flags.
> But the rest can be quite large. I can split them but I don't see the
> advantage particularly. Currently by using them (e.g.
> params.rate_of_decomp) it clearly distinguishes in the code this was a
> model parameter read in from a file. I could create more categories
> but it just means more names to remember and change in the code.
Well if you read those parameters from a file, I guess it's an INI file.
Then if you use configobj you get already a class which can be converted to a dict easily.
You can even validate the input to make sure you're not getting out of range values.
I always use ini files whenever I can configure something externally, and it works pretty well.
Does that help?
More information about the Python-list
mailing list