For review: PEP 308 - If-then-else expression

Georg Mischler schorsch at schorsch.com
Sun Feb 9 19:06:54 EST 2003


Paul Rubin wrote:

> from_deja at alandaniels.com (Alan Daniels) writes:
>> If use of the colon character is overloaded, how about just using the
>> "else" keyword instead? That's what the colon in C's ternary operator
>> essentially means anyway. So, we'd have something like:
>> 
>>   <condition> ? <expression1> else <expression2>
>> 
>> A small compromise between the C-syntax and a more Pythonish syntax.
>> I would find something like
>> 
>>   x = (y < 5) ? "Yep" else "Nope"
> 
> I like this.


At first I thought "eeek!", but five seconds later it already
started to look familiar and intuitive.


-schorsch

-- 
Georg Mischler  --  simulations developer  --  schorsch at schorsch com
+schorsch.com+  --  Lighting Design Tools  --  http://www.schorsch.com/




More information about the Python-list mailing list