Re: create dynamic instance

2010-07-18 Thread Ray
thanks a lot. I was really stupid. of course I should keep a references to use it later. -- http://mail.python.org/mailman/listinfo/python-list

Re: create dynamic instance

2010-07-16 Thread Andre Alexander Bell
On 07/16/2010 06:01 PM, Ray wrote: > 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 ? > """ You would have to keep references to your Test objects (untested code):

Re: create dynamic instance

2010-07-16 Thread Ray
On Jul 16, 12:17 pm, MRAB wrote: > Ray wrote: > > 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 o

Re: create dynamic instance

2010-07-16 Thread MRAB
Ray wrote: 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 h