class attribute confusion

Steve Holden steve at holdenweb.com
Mon Dec 6 01:58:29 EST 2010


On 12/3/2010 11:58 PM, Steven D'Aprano wrote:
> Right. If you define a *class* attribute, it lives in the class, not the 
> instance, and so all instances share the same value.

Unless, of course, an instance binds the same name in its namespace, in
which case it will (usually) mask the class attribute for that instance.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
PyCon 2011 Atlanta March 9-17       http://us.pycon.org/
See Python Video!       http://python.mirocommunity.org/
Holden Web LLC                 http://www.holdenweb.com/




More information about the Python-list mailing list