dicts vs classes

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Tue Jul 25 06:11:28 EDT 2006


In <1153821590.452329.208790 at i3g2000cwc.googlegroups.com>, Guyon Morée
wrote:

> I'm using simple classes as a container of named values and I'm
> instantiating a lot of them in a very short time.
> 
> i was wondering if there is any benefit in using dicts instead from a
> performance/memory usage point of view?

If you really have a memory problem read the documentation about
`__slots__`.  But I would only consider this if `a lot of` is several 100k
or millions of objects and the memory consumption really is a problem.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list