Proposed PEP for a Conditional Expression

Pete Shinners pete at visionart.com
Fri Sep 14 00:58:24 CEST 2001


>> <condition> if <expression a> else <expression>
> 
> But that appears to NOT scan like English.
> "one if by land two if by sea"

num_rings = 1 if enemy.onland() else 2

not the most graceful english, heh. and i suppose
it works if they are nested..

num_rings = 1 if onland() else 2 if onsea() else 3




More information about the Python-list mailing list