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/001926.html below:

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

[Python-Dev] Re: ternary operators (fwd)Tim Peters tim_one@email.msn.com
Tue, 1 Feb 2000 02:45:42 -0500
[Moshe Zadka]
> ...
> Adding nothing to the discussion, let me just mention how Scheme (my
> second favourite language) does it:
>
> (if bool true-result else-result)
>
> Well, of course this isn't relevant to Python because statements are not
> expressions, but there might be something in it: if could be also used
> as a function taking three arguments:

"if" is a special form in Scheme; all Python functions are strict;
short-circuiting is essential here.

> print if(long_answer, "Very good!", "correct")
>
> I have no idea how this will play with the parser. Anyone?

    if(a, b, c)

can't be distiguished from

    if (a, b, c):

before the colon is seen, so it requires more lookahead than Python's parser
is comfortable doing.





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