PEP308 :

sismex01 at hebmex.com sismex01 at hebmex.com
Fri Feb 14 10:58:06 EST 2003


> From: Roel Mathys [mailto:Roel.Mathys at yucom.be]
> Sent: Friday, February 14, 2003 9:33 AM
> 
> Could this work?
> 
> Ternary :
> 
> 	if x : ( "it 's alright" , "Bye bye" )
> 

The problem with this is that it's already a perfectly
legal statement; the part after ":" is a tuple; also,
being a tuple, it doesn't do shortcut evaluation.

>
> would be the same as :
> 
> 	if x :
> 		"it 's alright"
> 	else :
> 		"Bye bye"
>

I suppose this would need to be specialcased
by the compiler, else it might break a bunch
of code, or subtly change tuple or "if"
semantics. :-(

Because of it's need to switch "if"'s semantics,
-1

-gus





More information about the Python-list mailing list