[triangle-zpug] Python 2.5

Jim Allman jim at ibang.com
Wed Sep 20 16:49:03 CEST 2006


On Sep 19, 2006, at 2:15 PM, Chris Calloway wrote:
> Python 2.5 was released today:

I was happy to see (among other changes) the new "conditional  
expression" syntax:
	http://docs.python.org/dev/whatsnew/pep-308.html

C and some other languages use this syntax:
	x = cond ? true_value : false_value;

After trying (apparently) lots of code for legibility, Guido chose  
this instead:
	x = true_value if condition else false_value

Braces are recommended for additional clarity:
	x = (true_value if condition else false_value)

It's kinda funky, but I already like it better than the and...or  
trick that's current practice in Python (sorry Chris;-)

   =jimA=

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
. . . . . . . . . . . . . . .
Jim Allman
Interrobang Digital Media
http://www.ibang.com/
(919) 649-5760




More information about the triangle-zpug mailing list