siple for in expression

Mike Driscoll kyosohma at gmail.com
Tue Mar 3 11:34:26 EST 2009


On Mar 3, 10:05 am, "Matko" <IvaStipan... at inet.hr> wrote:
> Hello!
>
> Can someone help me to understand the following code:
>
> uv_face_mapping = [[0,0,0,0] for f in faces]
>
> Thank You very much!
>
> Matko from Croatia

That looks like a list comprehension. It basically creates a list by
iterating over some kind of collection. See the following sites for
more info:

http://docs.python.org/tutorial/datastructures.html#list-comprehensions
http://www.secnetix.de/~olli/Python/list_comprehensions.hawk
http://www.network-theory.co.uk/docs/pytut/ListComprehensions.html

Mike



More information about the Python-list mailing list