PEP-308 a "simplicity-first" alternative

Christian Tismer tismer at tismer.com
Wed Feb 12 23:02:50 EST 2003


Erik Max Francis wrote:
> Bengt Richter wrote:
> 
> 
>>This happens to fix the hole in old ternary idiom, but it is _not_
>>introducing a new ternary form or other complex context-dependent
>>stuff.
>>If
>>    (x and [y] or [b])[0]
>>
>>is understandable, ...
> 
> 
> It's "understandable," but it's not very readable, and it's hardly a
> good substitute for a genuine bulitin conditional operator.  The whole
> point of one is to increase readability; this _decreases_ readability
> (as does the other form involving and/or and lambdas).

I am (this time:) seconding you.
We are used to abuse "and", which leads us
to perfect the abuse with constructs like above.
Python has the merit to be almost readable even
to non-programmers.

Despite the fact that there are "and" and "or" with
already quite strange semantics which is not obvious.

We probably should not make them live forever by
increasing their refcounts too much. and/or are
bad building blocks for conditional expressions.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/







More information about the Python-list mailing list