A RetroSearch Logo

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

Search Query:

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

[Python-Dev] Re: Trinary Operators

[Python-Dev] Re: Trinary Operators [Python-Dev] Re: Trinary OperatorsGerald S. Williams gsw@agere.com
Fri, 7 Feb 2003 14:37:57 -0500
To me, the major problem with the (a and [b] or [c])[0]
solution shown in the FAQ is that it's not immediately
clear what you are doing. A more likely spelling of that
solution is:

  def ifelse(result): return result[0]
  ...
  x1 = ifelse(a and [x] or [y])
  x2 = ifelse(a and [x] or b and [y] or [z])
  x3 = ifelse(a and [x] or b and [y] or c and ...)

The q() function solution shown there doesn't extend
as nicely and forces you to add "lambda:" if you don't
want both alternatives evaluated.

-Jerry




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