Tanteauguri wrote: > Hi List, is there in python a variable variable like in PHP ($$var)? > > What I want to do is something like that: > > pc=["a","b","c"] > > for i in pc: > i = anyclass() > > a.shutdown() > b.update() > > > Any Ideas?
def seq(n,cls,*args,**kw):
"create a sequence of n objects of type cls."
return [cls(*args,**kw) for i in range(n)]
>>> a,b,c = seq(3,anyclass)
>>> a.shutdown()
>>> b.update()
Regards Kay
--
http://mail.python.org/mailman/listinfo/python-list
