The ternaery operator

alister alister.ware at ntlworld.com
Thu Mar 16 11:50:28 EDT 2017


On Thu, 16 Mar 2017 03:12:32 +0000, Stefan Ram wrote:

> The syntax
> 
> a if c else b
> 
>   looks as if Guido made it intentionally ugly so that it will not be
>   used?
> 
>   Being able to detect patterns that are in widespread use among
>   programming languages enhances readability.
> 
>   IIRC, in Algol, there was an expression
> 
> if c then a else b
> 
>   . IIRC, most popular languages today use
> 
> c ? a : b
> 
>   . But now Guido has invented something totally new. Why?
> 
>   Perl has something like it, the "expression modifier".
>   Did Guido like /this/ so much, that he wanted to imitate it?

>>>import this

i think you will find at least 1 line that explains everything.




-- 
We were so poor that we thought new clothes meant someone had died.


More information about the Python-list mailing list