> markersExp = ['big','boss','two','three']
> for mark in markersExp:
>     print y.mark
> 
> Now I have an list of class objects that are in an outerloop. y is how I 
> access it. The attributes names of the class objects match whats in 
> markersExp. 

Do you have to use string versions of the class names?
Why not:

class Mark: mark = 42
class big(Mark): pass
class boss(Mark): pass
class two(Mark): pass
class three(Mark): pass

markersExp = [big,boss.two,three]

for cls in markersExp: print cls.mark

Classes are objects too!

> Can I do that print statement in a way to allow me to print the 
> value of the class attribute?

Or are we really talking about instances? In which case the usual solution 
is a dictionary.

Alan g.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to