How do I initialize a list please?

Erik Max Francis max at alcyone.com
Tue Dec 31 23:22:54 EST 2002


jerf at compy.attbi.com wrote:

> Then create a list of those, like
> 
> l = []
> for i in range(10):
>         l.append(ComplicatedObject())
> 
> or
> 
> l = [ComplicatedObject for x in range(10)]

Just for the sake of accuracy, you meant

	l = [ComplicatedObject() for x in range(10)]

here.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ All your slick moves / They were once innocent moves
\__/ Sade
    Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
 A personal guide to Quake III Arena.




More information about the Python-list mailing list