Class Variable Question

Robert Johnson rjohnson at exotic-eo.com
Wed Apr 11 03:47:07 EDT 2001


> It's not entirely clear to me whether you mean to be talking about
> setting attributes of classes or attributes of class instances.

I am talking about "creating" attributes in class instances (not setting).
I come from the C++ community where the definition of a class is separate
from its implementation.  My ambiguous question and the variety of replies I
received actually helped me to understand that in Python a Class Object is
created the moment it is written and is separate from the Object instance,
which explains why some thought it strange that I would want to be able to
block the adding of attributes, effectively blocking a simple form of
inheritance.  In C++ the class object IS the instance and many C++
programming books use the terms "Object" and "Instance" interchangeably.
The splitting of Object and Instance is something that I did not catch in my
readings of Python programming books.

I think this is the first question I have ever posed to a newsgroup that has
generated such a large thread.

Thanks for the reply,

Robert Johnson





More information about the Python-list mailing list