Dictionnary vs Class for configuration

Donn Cave donn at u.washington.edu
Fri Apr 30 16:06:00 EDT 2004


In article <40929016$0$8635$626a14ce at news.free.fr>,
 "Famille Delorme" <fadelorme at free.fr> wrote:
...
> I want know :
>  - what is more faster, dictionnary method or class method?
>  - what use more ram memory ?
>  - if you are administrator, what method you like for configure program ?

I think there would be some arguments in favor of a class, but
they're not very important - at least, they're certainly not
evident in your example.  But you raise an important point, about
efficiency.

It isn't important, and you shouldn't think about anything else
until you understand this.

I mean, not that efficiency isn't important in general - it
certainly is - but not for a configuration record.  It will
have only a handful of parameters, one or two instances in
the whole program.  This is absurdly trivial.  Some time,
see if you can determine how much Python actually does just
to start itself up each time.  Just for perspective.

Don't worry about the efficiency of a construct that you aren't
going to exercise very hard.  Worry instead about maintainability,
because that's where software more commonly meets its fatal end.
Think about what your instructor is saying in that context.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list