The ternary operator: more than one way to do it?

Erik Max Francis max at alcyone.com
Tue Mar 11 02:30:37 CET 2003


Thomas Wouters wrote:

> pluswverbs = index == 1 ? pluswverbs ? length(pluswverbs) > 1 ?
> {{@pluswverbs[1], {i, verbname}}, @pluswverbs[2..$]} :
> {{@pluswverbs[1], {i,
> verbname}}} : {{{i, verbname}}} : (index == length(pluswverbs) ?
> {@pluswverbs[1..$ - 1], {@pluswverbs[$], {i, verbname}}} : (index >
> length(pluswverbs) ? {@pluswverbs, {{i, verbname}}} :
> {@pluswverbs[1..index
> - 1], {@pluswverbs[index], {i, verbname}}, @pluswverbs[index +
> 1..$]}));

Any language feature can be abused.  The writer of the abuse is to blame
for such misuses, not the language.

> (It's not Python, it's MOO, written by me about 8 years ago :)

I rest my case.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ One completely overcomes only what one assimilates.
\__/ Andre Gide
    EmPy / http://www.alcyone.com/pyos/empy/
 A templating system for Python.




More information about the Python-list mailing list