[Python-Dev] Trinary Operators
Greg Ward
gward@python.net
Fri, 7 Feb 2003 08:09:52 -0500
On 06 February 2003, Andrew Koenig said:
> Notwithstanding which, I occasionally wish that Python had an
> if-then-else operator.
>
> I personally like the way Algol 68 does it, although I acknowledge
> that Python couldn't really do it the same way because Algol 68
> does not distinguish between statements and expressions.
Yes! My only experience with Algol 68 was in an undergrad programming
language survey course about 10 years ago, and I remember thinking at
the time that they really got it right back in '68.
I also have a dim recollection of pestering Guido about the
statement/expression divide once, and he insisted that it was a
feature. I respectfully disagree; I think we're all grown-ups here and
we can decide between ourselves when an expression is really a
statement. This is one thing that I think C got right (although
"if (x = ...)" is an abomination that should, at the very least,
generate a stern warning).
Greg
--
Greg Ward <gward@python.net> http://www.gerg.ca/
If it can't be expressed in figures, it is not science--it is opinion.