Loop in list.

Jeremy Jones zanesdad at bellsouth.net
Tue Feb 8 09:57:08 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.
>
>  
>
It's called a list comprehension and it appeared in Python 2.0.

http://www.amk.ca/python/2.0/index.html#SECTION000600000000000000000



Jeremy Jones



More information about the Python-list mailing list