classes vs dicts

Yermat loic at fejoz.net
Thu May 6 06:29:38 EDT 2004


Charlie wrote:
> Greetings,
> 
> I am pretty new to Python and like it very much, but there is one
> thing I can't figure out and I couldn't really find anything in the
> docs that addresses this.
> 
> Say I want to write an address book program, what is the best way to
> define a person (and the like): create a class (as I would do in Java)
> or use a dictionary?
> I guess using dictionaries is fastest and easiest, but is this
> recommended?
> 
> Thanx for any help.

create a class !

You're wrong when you're saying that dictionaries is fastest because 
class use dictionaries to find attributes so that the same ! But class 
is nicer to read and manage...

-- 
Yermat




More information about the Python-list mailing list