Loop in list.

Diez B. Roggisch deetsNOSPAM at web.de
Tue Feb 8 10:01:15 EST 2005


Jim wrote:

> Where did this type of structure come from:
> 
> mat = ['a' for i in range(3)]    ?
> 
> This will produce a list of three elements but
> I don't see reference for it in any of the books.

Its called a list-comprehension. And as I don't know what books you mean, I
can't say if its covered there or not.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list