create dynamic instance

Ray rui.vapps at gmail.com
Fri Jul 16 12:01:01 EDT 2010


class Test:
  def __init__(self):
    self.value=0
  def change(self, val):
    self.value=val

if __name__=='__main__':
  for x in range(10):
    x=Test()
  """
  the question is how do i call x.value outside of that for loop?
  something like
  print x.value ?
  """

thanks for any help.



More information about the Python-list mailing list