PEP 308: Obfuscated Nested Ternaries (INACAIS)

Steven Taschuk staschuk at
Fri Feb 21 00:56:57 CET 2003

Quoth Gerrit Holl:
> For the Obfuscated Contest: rewrite this peace of code
> using ternaries. Preferably with a lot of ('s and )'s :)

How's this?

        seq = tuple([((tl,t,tr),(l,None,r),(bl,b,br))[y][x]for x,y in
                (lambda x:zip(x[0],x[1]))(map(lambda x,y:map(x==1 and
                (lambda x:2-x)or None,y),map(cmp,(x,y),(0,)*2),((((2,

Only one ternary operator, I'm sorry to say.  Lots of parentheses,

Steven Taschuk                            staschuk at
Every public frenzy produces legislation purporting to address it.
                                           (Kinsley's Law)

More information about the Python-list mailing list