[Tutor] Populating a list with object to be called by a class
eryksun at gmail.com
Thu Sep 20 21:48:05 CEST 2012
On Thu, Sep 20, 2012 at 3:39 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> On 21/09/12 02:57, eryksun wrote:
>> On Thu, Sep 20, 2012 at 12:25 PM, eryksun<eryksun at gmail.com> wrote:
> Preferred terminology is attribute, not variable. Class attributes live
> in the class and are shared across all instances. Instance attributes
> live in the instance and are not shared.
That's correct. I try to be careful about terminology, but I slip up
from time to time. My first OO language was Java.
>> The subclass gets a shallow copy of the parent class namespace.
> Not so much.
> py> class C(object):
> ... x = 1
> py> class D(C): pass
> py> D.__dict__ == C.__dict__
> py> 'x' in D.__dict__
If you didn't notice, I followed up with a correction. But thanks.
More information about the Tutor