[2.2b2]: class variable and classmethod, subclass

{-- Rot13 - Hateme ungrzr2 at ubatxbat.pbz
Wed Nov 28 15:29:50 CET 2001


Andreas Kostyrka <andreas at mtg.co.at> wrote in
news:mailman.1006931558.4505.python-list at python.org: 
> 
> "{-- Rot13 - Hateme" <ungrzr2 at ubatxbat.pbz> writes:
>> In 2.2B2
>> Inside a class,I did a change to a class variable inside the class'
>> classmethod. If the variable has not been changed in the subclass
>> before, the class variable in the subclass of the class is also
>> changed. Is this behavior intentional or a bug? 
> 
> Well, it is the Pythonish way. Actually class variables in Python never
> had anywhere the semantics one might be used from other languages.
> (*grin* Never forget, Python is THE Lisp of Hashtables, instead of Cons
> cells ;) ) 
> 

Thanks for your guys' answers.

It sucks though. :) At least subclasses should not share
the class variables with their parents. Why does it make 
sense?







More information about the Python-list mailing list