[Python-ideas] Fwd: quantifications, and tuple patterns
Paul Moore
p.f.moore at gmail.com
Sun Jan 15 00:27:48 CET 2012
On 14 January 2012 23:07, Guido van Rossum <guido at python.org> wrote:
>> BTW, as I'm sure everyone knows, you can simulate assignment-as-expression
>> with
>>
>> def asgn(o, val):
>> o.ans = val
>> return val
>>
>> >>> any(asgn(c,x) for x in (1,2,3) if x%2 == 0)
>> True
>> >>> c.ans
>> 2
>
>
> Eew. :-(
Agreed. Assignment-as-expression is nicer. But I have to say I've
never really missed it in Python until this discussion started.
Question. Do you object to assignment-as-expression per se, or merely
as the default way of looking at assignment? Or to put it another way,
would something like my x := val (or maybe x <- val or something else)
be acceptable?
Paul.
More information about the Python-ideas
mailing list