One-step multiples list generation?

Damien Wyart damien.wyart at free.fr
Tue Jan 3 12:57:31 EST 2006


* Efrat Regev <efrat_regev at yahoo.com> in comp.lang.python:
> Suppose I have some non-numerical Foo and would like to create a list
> of 20 Foo-s. Is there a one-step method (not a loop) of doing so?

Maybe :

[ Foo ] * 20

or, more verbose,

[ Foo for _ in range(20) ]

?

-- 
DW



More information about the Python-list mailing list