PEP 308 - ternary operator

Wolfgang Strobl wks000 at
Sun Feb 16 21:29:35 CET 2003

Erik Max Francis <max at>:

>Wolfgang Strobl wrote:
>> I'm not quite shure whether this is old news or not, but I haven't
>> seen
>> the following mentioned here.
>> Jason Orendorffs entry, a tiny version of "Collossal Cave",
>> resp
>> got a "best of show" award in the latest International Obfuscated C
>> Code Contest.  IMHO, a great part of its obfuscation is owed to Cs
>> ternary operator. For example, the state machine that runs the game is
>> a single loop evaluating a single expression composed of a rats nest
>> of
>> thirty six  ?: and thirty six logical ors - without a single bracket!
>So?  Do you really think people would write such things in production

Frankly, I don't know. Probably not.  

Counter question: do you really believe that it needs a sequence of 36
ternaries do get an incomprehensible expression? I don't think so.
Quick,without the help of a compiler: what does 
print, for int a=1,b=2,c=3;? 

>Any structure _can_ be used to obfuscate.  

But some fit the job better than others. :-)

Thank you for observing all safety precautions

More information about the Python-list mailing list