Newbie questions

sismex01 at hebmex.com sismex01 at hebmex.com
Mon Mar 24 18:20:49 CET 2003


> 
> 1.
> Is there a faster way to allocate a list of objects than this one?
> 
> ls=cnt*[None]
> for j in range(cnt):
>     ls[j]=TestClass(j)
> 

ls = [ TestClass(j) for j in range(cnt) ]


-gustavo





More information about the Python-list mailing list