A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-February/033111.html below:

[Python-Dev] Trinary Operators

[Python-Dev] Trinary Operators [Python-Dev] Trinary OperatorsGuido van Rossum guido@python.org
Thu, 06 Feb 2003 14:49:23 -0500
> If this is just for fun, why stop with just "trinary"?

(Which BTW is a non-word; the correct term is "ternary".)

> How about one of the following (depending on ease of parsing)?
> These look even more like list comprehension.
> 
>   x = (e1 if c1        e2 if c2        e3 if c3  ...  else d)

Doesn't parse.  The concatenation of two expressions is not
always distinguishable from a single expression: consider c1 = f and
c2 = (1, 2).

>   x = (e1 if c1  else  e2 if c2  else  e3 if c3  ...  else d)

That works.

--Guido van Rossum (home page: http://www.python.org/~guido/)



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4