dicts vs classes

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Tue Jul 25 11:57:30 EDT 2006


Simon Hibbs:
> It seems to me that unless you
> need some of the functionality supplied with dictionaries (len(a),
> has_key, etc) then simple objects are a syntacticaly cleaner and more
> natural way to express yourself.

I'd say the opposite. Classes contain a dict of their attributes, etc.
So if you don't need the functionality supplied by objects, then using
simpler dictionaries is better. (But in the end the choice has to be
made according to the specific situations).

Bye,
bearophile




More information about the Python-list mailing list