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/2005-September/056585.html below:

[Python-Dev] Adding a conditional expression in Py3.0

[Python-Dev] Adding a conditional expression in Py3.0 [Python-Dev] Adding a conditional expression in Py3.0Barry Warsaw barry at python.org
Wed Sep 21 00:49:27 CEST 2005
On Tue, 2005-09-20 at 18:21, Thomas Lotze wrote:

> Nothing prevents you from spreading the code over multiple lines, like so:
> 
> x = (if a then b
>      elif c then d
>      else e)
> 
> or even
> 
> x = (if a then
>         b
>      elif c then
>         d
>      else
>         e
>     )
> 
> especially as there are going to be parentheses around the whole thing
> anyway. From a readability point of view, this is no different from
> if-statement blocks, and the matter is IMO not worth dumbing down an
> if-expression thingy as compared to its if-statement companion.

I guess that's my point.  To me, your latter is actually worse than

if a:
    x = b
elif c:
    x = d
else:
    x = e

I think the conditional stuff gets the most bang for the buck in
situations like:

d[foo] = if a then b else c

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20050920/561d120c/attachment.pgp
More information about the Python-Dev 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