inheriting variables

Haran Shivanan hs2l2ATyahoodotcom at yahoo.com
Thu Apr 17 13:08:02 EDT 2003


module "Steve Holden" core dumped with the following output:
> 
>>>> class A:
> ...   a = 0
> ...   b = 1
> ...
>>>> class B(A):
> ...   pass
> ...
>>>> b = B()
>>>> A.a = 23
>>>> b.a
> 23
>>>>
> 
> I suspect the OP wants a separate class variable for each subclass. Right,
> Haran?
Right.
The variables in the subclass should not be bound to the parent.
Any ideas?
> 
> regards
> --
> Steve Holden                                  http://www.holdenweb.com/
> How lucky am I?      http://www.google.com/search?q=Steve+Holden&btnI=1
> Python Web Programming                 http://pydish.holdenweb.com/pwp/
> 
> 
> 
> 


-- 
Kaa's Law: In any sufficiently large group of people, most are idiots.




More information about the Python-list mailing list