Loop in list.

Bill Mill bill.mill at gmail.com
Tue Feb 8 10:00:00 EST 2005


Jim,

That is called a "list comprehension", and it is a feature which
appeared in python 2.3 (iirc). Thus if your books are about earlier
versions of python, list comprehensions will not be covered.

Check out the section of the tutorial about them at
http://docs.python.org/tut/node7.html#SECTION007140000000000000000 .

Peace
Bill Mill
bill.mill at gmail.com


On Tue, 08 Feb 2005 06:50:08 -0800 (PST), Jim <jtp11 at att.net> 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.
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list