On Thu, Sep 20, 2012 at 3:39 PM, Steven D'Aprano <st...@pearwood.info> wrote:
> On 21/09/12 02:57, eryksun wrote:
>>
>> On Thu, Sep 20, 2012 at 12:25 PM, eryksun<eryk...@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__
> False
> py> 'x' in D.__dict__
> False


If you didn't notice, I followed up with a correction. But thanks.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to