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/2000-February/001924.html below:

[Python-Dev] Re: ternary operators (fwd)

[Python-Dev] Re: ternary operators (fwd) [Python-Dev] Re: ternary operators (fwd)Moshe Zadka Moshe Zadka <mzadka@geocities.com>
Tue, 1 Feb 2000 07:51:08 +0200 (IST)
On Mon, 31 Jan 2000 gvwilson@nevex.com wrote:

> So I asked Simon Peyton-Jones and Phil Wadler how languages other than C
> and its derivatives did conditional expressions; one of the replies was:
<snipped>
> Perhaps this would be a good time to ask around and see what else people
> have in their back pockets?

Adding nothing to the discussion, let me just mention how Scheme (my
second favourite language) does it:

(if bool true-result else-result)

Well, of course this isn't relevant to Python because statements are not
expressions, but there might be something in it: if could be also used
as a function taking three arguments:

print if(long_answer, "Very good!", "correct")

I have no idea how this will play with the parser. Anyone?
--
Moshe Zadka <mzadka@geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.




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