[Tutor] confused: classes containing dicts
Calum Mackay
calum.mackay at cdmnet.org
Sat Oct 9 03:55:22 CEST 2004
thanks very much for the reply, Kent,
> This is close. Instances of C don't have an attribute l, it is just the
> class that has this attribute. The way attribute lookup works for
> classes is, if the attribute isn't found in the instance, look for it in
> the class (and the super classes). This is pretty much what happens when
> you access an instance method, too - the actual method is a class
> attribute.
That makes sense, thanks, and explains why I couldn't see 'l' when I
pprinted the instance.
> The first few pages of chapter 21 of Learning Python talk about this a
> little.
Yup, it looks like I glossed over them )
time for another read...
cheers,
calum.
More information about the Tutor
mailing list