[Python-Dev] Change in evaluation order in new object model

David Ascher DavidA@ActiveState.com
Fri, 02 Nov 2001 09:39:25 -0800


"M.-A. Lemburg" wrote:

> Could someone please first explain what these slots are used for
> in the first place :-? There must be some difference to standard
> class attributes... which is probably also the reason for the
> above behaviour (even though it does look like a bug to me).

My understanding is that the slots define the set of attributes-like
things that instances of that class can have.  It 'robs' the instances
of such classes from having a __dict__ (at least conceptually), and
provides much lighter weight attributes.  Instances only need to store
the _values_ in a struct/array, while the set of slot names and their
order (in memory) is kept at the class level.

This sort of thing is helpful from a memory point of view when you're
dealing with e.g. large numbers of similar objects  which all share the
same attribute set (coordinates, Tk labels, whatnot).

It doesn't explain (to me at least) why the lookup order is different.

--david