Some syntactic sugar proposals
Mel
mwilson at the-wire.com
Wed Nov 17 10:18:51 EST 2010
Christopher wrote:
>> ? Of course we can write it as
>> t = foo() if pred(foo()) else default_value
>> but here we have 2 foo() calls instead of one. Why can't we write just
>> something like this:
>> t = foo() if pred(it) else default_value
>> where "it" means "foo() value"?
>
> i don't like magic names. what about:
>
> t = foo() as v if pred(v) else default_value
!! so: assignment inside an expression.
Mel.
More information about the Python-list
mailing list