PEP 308 - ternary operator
Wolfgang Strobl
wks000 at t-online.de
Sun Feb 16 15:29:35 EST 2003
More information about the Python-list mailing list
Sun Feb 16 15:29:35 EST 2003
- Previous message (by thread): PEP 308 - ternary operator
- Next message (by thread): PEP 308 - ternary operator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Erik Max Francis <max at alcyone.com>: >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", >> >> http://www0.us.ioccc.org/2001/jason.c resp http://www.ioccc.org/ >> >> 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 >code? 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 printf("%d",c-a?b*c-6?c:a+b*c-1:2); 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
- Previous message (by thread): PEP 308 - ternary operator
- Next message (by thread): PEP 308 - ternary operator
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list