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/056583.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.0Thomas Lotze tl at gocept.com
Wed Sep 21 00:32:53 CEST 2005
Guido van Rossum wrote:

> I think I'd prefer (if <expr> then <expr> else <expre>) i.e. no colons.
> None of the other  expression forms (list comprehensions and generator
> expressions) involving statement keywords use colons.

While I like the looks of the form without colons better, I can't quite
follow this argument for it.

In LCs and GEs, colons wouldn't make any sense in the first place because
the expression controlled by "for" and "if" is written before it:
[expression(x) for x in y]. Just where would anyone put a colon there,
anyway?

A colon does make sense if something follows it, as is currently the case
in lambda expressions. It would also be the case in an (if x: y else: z)
form.

I have a feeling that trying to make all expression forms which happen to
use statement keywords colon-free is seeking an artificial consistency.
I'm happy to be proven wrong, though.

+1 on the idea of introducing a conditional expression in the first place,
though.

-- 
Thomas


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