ternary operator

Tim Peters tim.one at comcast.net
Thu Feb 6 19:44:58 EST 2003


[Alex Martelli]
> ...
> (I _think_ Algol 60 didn't have "short-circuiting conditional
> expressions" either, and it did make a distinction between statements
> and expressions, like Pascal and unlike Algol 68 -- but it's been far
> too long since I actually used Algol for me to feel certain about it),
> so that is hardly surprising.

The Algol 60 Revised Report is available online; e.g., a nice rendering with
a few helpful hyperlinks is at

    http://www.masswerk.at/algol60/report.htm

Your memories are all on target.  Unlike as in Python, a bare expression
isn't allowed where a statement is required (Python blurred the distinction
for the benefit of interactive mode), so there's no confusion between Algol
60's if/then/else conditional statement and Algol 60's if/then/else
arithmetic expression (an "if" is the start of an Algol 60 statement if and
only if "if" is the first token of a statement following the statement's
labels (if any)).

> I don't think there are implications about Python from the choices
> historically made by Backus, Naur, Wirth, and others in the '60s, but
> nevertheless I'd appreciate clarification by careful historians...

Better to go to the source:  the Algol 60 report is still a marvel of
succinct clarity.

nobody-has-time-for-brevity-anymore-ly y'rs  - tim






More information about the Python-list mailing list