[Python-ideas] Fwd: quantifications, and tuple patterns

Paul Moore p.f.moore at gmail.com
Mon Jan 16 20:29:11 CET 2012


On 16 January 2012 14:47, Devin Jeanpierre <jeanpierreda at gmail.com> wrote:
> You can always add a full-on assignment-as-expression, if you're
> concerned about that.
>
>    if (m := pat.search(data)) is not None:
>
> Also, the keyword doesn't have to be "if". I've always read the bar as
> "such that" or "where".

I suggested that a while back in this thread (in the form of any(var
:= val for val in itr if pred)). It didn't get much traction.

Paul.



More information about the Python-ideas mailing list