"Jim" <[EMAIL PROTECTED]> 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 "list comprehension", and was added in Python 2.0.

    http://www.amk.ca/python/2.0/index.html#SECTION000600000000000000000
    http://docs.python.org/tut/node7.html#SECTION007140000000000000000
    http://docs.python.org/ref/lists.html

Python 2.4 introduces a variation called "generator expressions":

    http://www.python.org/doc/2.4/whatsnew/node4.html
    http://www.python.org/peps/pep-0289.html
    http://docs.python.org/ref/genexpr.html

</F> 



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to