claird at lairds.us
Sat Mar 19 13:08:03 CET 2005
In article <1111229201.840663.141530 at g14g2000cwa.googlegroups.com>,
Kay Schluehr <kay.schluehr at gmx.net> wrote:
>> Hi List, is there in python a variable variable like in PHP ($$var)?
>> What I want to do is something like that:
>> for i in pc:
>> i = anyclass()
>> Any Ideas?
> "create a sequence of n objects of type cls."
> return [cls(*args,**kw) for i in range(n)]
>>>> a,b,c = seq(3,anyclass)
I'm going to make this explicit: the PHP idiom is a defect.
Yes, I know that's good style among top PHP practitioners,
but, from all I know, it's simply a bad habit. The advice to
use a dictionary is on target.
More information about the Python-list