Python Gurus,
I got a question for ya.  Below I have three instance variables (self.A,
self.B, etc).  How can I use the below
for loop for A, B, C to also call those instance variables?

Example
###############
<some code>
.....
.....
 self.A          = 1
 self.B    = 2
 self.C    = 3

myDict = {'A': 1, 'B': 2, 'C': 1}
for x in [A, B, C]:

  if myDict[x] == (self.%s % (x)): # Invalid if statement.. ;-)
print "Yep, we have a match!"
  else:
print "Sorry..No match!"
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to