Martin v. Löwis wrote:
That's not the full syntax. The full syntax is

    [ <test> for <exprlist> in <testlist> <list-iter-opt> ]

where

<test> can be an arbitrary expression: and, or, lambda, +, -, ...
<exprlist> can be a list of expression, except for boolean and
relational expressions (but I think this is further constrained
semantically)
<testlist> list a list of tests
<list-iter-opt> is optional, and can be another for or if block

Aren't these names a bit mixed up w.r.t. what's in that position? As far as I know
<test> is not a test but a function as it produces any value not just True/False
<exprlst> is a list of names, not arbitrary expressions
<testlist> is anything which will produce an iterator


Or so I've understood so far.

So a more complex example is

[ lambda a: a[x]+y*z for x,y in A for z in B if x > z]
I'm schocked ;-)

--eric
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to