Class variables static by default?
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sat Dec 19 23:16:16 EST 2009
On Sun, 20 Dec 2009 11:44:11 +1100, Lie Ryan wrote:
> In python, 'class variable' is a variable that belongs to a class; not
> to the instance and is shared by all instance that belong to the class.
Surely, since string variables are strings, and float variables are
floats, and bool variables are bools, and module variables are modules, a
class variable will be a class and an instance variable will be an
instance?
> In contrast, 'instance variable' belongs to the instance, and each
> instance can make their instance variables refers to different objects
> than the other instances.
The usual term used in Python is "class attribute" and "instance
attribute" for the named fields of a class or instance.
--
Steven
More information about the Python-list
mailing list