ternary operator

Carlos Ribeiro cribeiro at mail.inet.com.br
Fri Feb 7 20:31:01 EST 2003


On Saturday 08 February 2003 01:22 am, Carel Fellinger wrote:
> On Sat, Feb 08, 2003 at 12:37:48AM +0000, Carlos Ribeiro wrote:
> ...
>
> > As for myself, being an old Pascal/Delphi addict, I'm used to (relying
> > on) short-circuiting expressions, but I avoid it if I feel it will make
> > the code less clear.
>
> What hideous dialect of Pascal did you grew up with that made you
> believe short-circuiting semantics to be defined in the language?

Just a clarification. I never thought that this was about to become a 
quasi-flame-feast, and I just wanted to point out that:

a) there are different evaluation modes for logical expressions, short 
circuiting being only one of the options, AND ...

b) that the ternary operator is (by definition) a short-circuiting 
alternative, AND ...

c) that it can't be properly simulated by a function, because functions 
evaluate their arguments at call time, UNLESS ...

d) you have something called lazy evaluation ...

e) which is something Python do not support.


As far as Pascal is concerned, I *know* that short-circuiting is not part of 
the language. As I said above, I was an old Pascal/Delphi addict, from what 
you can infer that I used Turbo Pascal, and then Borland Pascal, and later 
Borland Delphi - all of which offering short-circuiting evaluation. If that's 
a capital sin, please forgive me. I give up.


Carlos Ribeiro
cribeiro at mail.inet.com.br





More information about the Python-list mailing list