steven_h at acm.org
Fri Jun 6 16:52:45 CEST 2008
I believe it is a sequential lookup. The motivation to use __slots__
disappears when you have classes with a large number of attributes,
since you no longer save anything on the per-instance dictionary
overhead. __slots__ is best for classes like Point, where you will
have many, many instances with few attributes.
On Fri, Jun 6, 2008 at 9:19 AM, Mark Erbaugh <mark at microenh.com> wrote:
> Does anyone know how a class/instance with __slots__ finds an attribute?
> Without __slots__, there is a dict that is searched for the attribute.
> With __slots__ what is the lookup mechanism? I'm wondering if it
> involves a sequential lookup, thus making __slots__ access slower for
> classes with a large number of attributes.
> CentralOH mailing list
> CentralOH at python.org
More information about the CentralOH