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

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

[Python-Dev] Re: ternary operators (fwd) [Python-Dev] Re: ternary operators (fwd)David Ascher da@ski.org
Mon, 31 Jan 2000 21:33:41 -0800
From: <gvwilson@nevex.com>

> > > > d <c> e
> Replace '<' and '>' with the symbols of your choice --- embedding the
> conditional in the middle is still an interesting idea...

Which brings us back to if and else:

a = condition ? truecase : falsecase

would be

a = truecase if condition else falsecase

What's unintuitive at this point is the shortcutting, assuming that it would
still apply.  'condition' would get evaluated before truecase, and truecase
might not get evaluated at all.  Still, it 'reads' good to me. Not sure it's
all that Pythonic though.

--david






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