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

[Python-Dev] conditional expressions?

[Python-Dev] conditional expressions?Tim Peters tim.one@home.com
Tue, 16 Oct 2001 00:41:50 -0400
[Daniel Mahler]
> Has an if(cond,exp1,exp2) syntax been considered?

Not seriously, no.  That looks like a function call, and function arguments
are always evaluated in Python, and that works against seeing this as a
short-circuiting construct:

    q = if y then x/y else copysign(INFINITY, x)

> It would have the advantage that existing
> syntax sensitive editors would handle without change.

I don't see any problem there (and am responsible for two context sensitive
Python edit gimmicks, and used to be responsible for a third -- all I expect
to need to do is get "then" at token level colored as keyword).

> I think conditional exprs badly needed,
> but the if/then/else syntax seems too verbose for use inside
> expressions.

Good -- then you won't be tempted to abuse it <0.5 wink>.

best-in-small-doses-ly y'rs  - tim




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