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/2001-October/017980.html below:

[Python-Dev] conditional expressions?

[Python-Dev] conditional expressions? [Python-Dev] conditional expressions?Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 17 Oct 2001 13:51:39 +1300 (NZDT)
Guido:

> Someone else:
>
> > I was its only fan within PythonLabs, and I was lukewarm.  The trick is to
> > view "if c else" as a new short-circuiting infix binary operator (for each
> > c), and then it makes great-- even elegant --sense.

I think it makes sense in its own right -- no need for
"tricks".

> Also I believe it would create a parsing problem in list
> comprehensions;
>
> [x for x in range(10) if small else range(100)]

Parentheses would need to be required in that case:

  [x for x in (range(10) if small else range(100))]

I don't see that as a big problem -- wanting to put a conditional 
expression in that position is going to be fairly rare.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+



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