A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-March/052204.html below:

[Python-Dev] comprehension abbreviation (was: Adding any() and all())

[Python-Dev] comprehension abbreviation (was: Adding any() and all()) [Python-Dev] comprehension abbreviation (was: Adding any() and all())Eric Nieuwland eric.nieuwland at xs4all.nl
Tue Mar 15 22:46:36 CET 2005
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4