Static class attributes

Terry Hancock hancock at anansispaceworks.com
Mon Dec 9 00:44:29 EST 2002


On Sunday 08 December 2002 05:24 pm,  Timothy Grant  wrote:
> Is there now a good way to create class static attributes? (e.g., an
> attribute that is shared across all classes of a given type?) In the

All "class"es have the same "type": "class". If we were using Python 
terminology, so I guess you must not be.  If you instead mean, all 
"instances" of the same "class" then the answer is trivial -- you just use a 
class attribute:

class my_class:
	this_is_a_class_attrib = 'spam'
	def __init__(self, ham):
		self.this_is_an_instance_attrib = ham

I'm not sure what else you might mean.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com

"Python takes the pain out of programming ...
            ... and Zope puts it back again."




More information about the Python-list mailing list