[Zope] Class variables in ZClasses

Darran Edmundson Darran.Edmundson@anu.edu.au
Thu, 02 Dec 1999 18:41:19 +1100


The following quote is taken from lstaffor's ZClass 
Properties HOW-TO:
   http://www.zope.org/Members/lstaffor/zProperties

-----
In the field of object-orientented programming, the terms 
"class variables" and "instance variables" are often used 
for the data structures that are common to all methods of
a class or of an object that is an instance of that class.
... For example, you may want a given data item to be a 
constant that is shared by all instances; the constant 
can be changed only by changing the class definition. 
----

I'm confused about how class variables are implemented in
Zope.  For example, let's say I have a ZClass with instance 
variable "Subject" which is a list of keys into a dictionary
"SubjectChoices".  Rather than every instance maintaining a
separate copy, SubjectChoices should be a class variable -
all instances see the same dictionary.  Any insights would
be most appreciated.

Cheers,
Darran.

-- 
Darran Edmundson [Darran.Edmundson@anu.edu.au]