ternary operator

Carlos Ribeiro cribeiro at mail.inet.com.br
Fri Feb 7 01:14:18 CET 2003


On Thursday 06 February 2003 11:50 pm, Alex Martelli wrote:
> Paul Rubin wrote:
> > Yeah.  I've never understood this obsession with keeping conditional
> > expressions out of Python.  They didn't confuse people in Algol-60 and
> > I think Pascal (designed as newbie language from the beginning) had
> > them too.
>
> I believe you misremember.  Pascal, as designed (as a language for
> newbies) by N. Wirth, had no conditional expressions (and no logical
> operators that ensured short-circuiting, either).

I can tell for sure that Pascal did not support conditional expressions. Even 
short circuiting is not part of the language - there is nothing in the 
language definition about this. However, Borland line of Pascal compilers had 
a switch to set the logical expression evaluation mode: short circuit or full 
evaluation. That may be the reason why some people believe that (standard) 
Pascal supported it.

> 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...

It seems to be impossible not to be aware of the choices made by those people 
- they've helped to define programming language design as a science. Now, if 
would-be 'designers' just keeping throwing away feature after feature at 
every new language design, it's their fault alone. Learning from the mistakes 
(and successes) of the masters is the *best* education possible.

[btw, the adoption of indented blocks over brace/keyword delimited ones was a 
deliberate design decision by Guido; I've read somewhere in a interview by 
Guido himself that it involved a lot of considerations about the shortcomings 
of the then-standard practice. So...]


Carlos Ribeiro
cribeiro at mail.inet.com.br





More information about the Python-list mailing list