Class or Dictionary?
ethan at stoneleaf.us
Fri Feb 11 19:47:45 CET 2011
Andrea Crotti wrote:
> On Feb 11, 3:56 pm, Martin De Kauwe <mdeka... at gmail.com> wrote:
>> I have a series of parameter values which i need to pass throughout my
>> code (>100), in C I would use a structure for example. However in
>> python it is not clear to me if it would be better to use a dictionary
>> or build a class object? Personally I think accessing the values is
>> neater (visually) with an object rather than a dictionary, e.g.
>> x = params['price_of_cats'] * params['price_of_elephants']
>> x = params.price_of_cats * params.price_of_elephants
> Visually neater is not really a good parameter to judge.
I strongly disagree. Code readability is one of the most important issues.
More information about the Python-list