Some syntactic sugar proposals

Christopher nadiasvertex at gmail.com
Wed Nov 17 09:01:58 EST 2010


> ? 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





More information about the Python-list mailing list