[Python-Dev] Re: Trinary Operators

Eric S. Raymond esr@thyrsus.com
Thu, 6 Feb 2003 15:13:04 -0500


Guido van Rossum <guido@python.org>:
> I'm not sure yet how lambda and if/else should group relative to each
> other.

I am.  Lambda should bind more loosely.

Consider the typical callback lambda usage case:

     MyGuiButton(lambda: mysort() if mode == SORT else browse(), "Do it.")

That is, I definitely want the scope of the lambda to go all the way to
the comma.

I like the suggestion for the extended n-ary form.  Partly because it's 
a stronger helper for the most important usage context, but also because
it moves Python more towards being an expression-oriented language.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>