A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/072895.html below:

Conditional operator in Python?

Conditional operator in Python? Conditional operator in Python?Sheila King sheila at spamcop.net
Mon Apr 2 11:02:07 EDT 2001
On Mon, 2 Apr 2001 10:27:37 +0000 (UTC), duncan at rcp.co.uk (Duncan Booth) wrote
in comp.lang.python in article <Xns907772F534CFAduncanrcpcouk at 127.0.0.1>:

:
:Please don't do this, as it doesn't do what you think.
:
:>>> a = 0
:>>> b = -5
:>>> (a > b) and a or b
:-5
:
:and consider that one of the common uses for a max function is to set a 
:lower bound of 0 on a calculation.

The reference I sited in the post you are replying to:
http://diveintopython.org/apihelper_andor.html

goes over that difficulty and how to get around it.

Still, I personally wouldn't use this method. if-else seems fine to me?

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/


More information about the Python-list mailing list

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