[Tutor] OK, dumb question

alan.gauld@bt.com alan.gauld@bt.com
Tue, 8 Jun 1999 11:52:04 +0100


> I seem to be stuck on the littlest of problems, how do I do 
> this in Python:
> 	iterate through a 'list' (term used loosely) of twelve 
> class variables, 
> check each for changes
> I know how to do this in C++, but for the life of me cannot make the 
> connection in Python. Here is an example(with my infamous spam):

Just a minor nit pick, but I assume you mean a list of class instances?
(since I don't think the concept of class variables exists in C++)

ie you have a list of instances of Meat or Spam? 

m = Meat()
s = Spam()
ObjList = [m,s]

Not a list of classes:

classlist = [Meat, Spam]

Just to be clear about what we're trying to do...

>       #In my 'real' script I would be testing 12-20 class 
> member variables 

Uh, this is different again - class member variables? (aka static in C++) 
or instance variables?

slightly confused about what your trying to do here.

Alan g.