PEP-308 a "simplicity-first" alternative

Christian Tismer tismer at
Thu Feb 13 03:30:09 CET 2003

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, why not the much simpler logical-true-wrapper in
>     x and {y} or b

OT, not digging into the discussion.
But re-thinking the good old and/or operators
and their use once again. I have been used
to the for years, and they make sense in some
contexts, although it is slightly weird, that
they don't produce truth values, but the last object.

Exactly this behavior *allows* to build the constructs
which now need to be cured.

Even worse, what these work-arounds are trying to do is:
They want to attach a new truth value, in order to make
and and or behave as the user intends.

But then, look what we are doing: We are tricking a truth
value, in order to be able to abuse a truth operator, which
happens to have the side effect of carrying a value.

I have been programming in Python too long, so it took
this much time to realize this again.
Isn't that *horrible*?

I like your idea, it is correct, given that we want to
continue to abuse logical operators. Therefore, your
solution is of the same minimalistic level as Holger's,
which just says "this is bad enough, make a small change
got get it better."
Or, speling it differently, using such a small change might
help to calm all these threads down and to have a replacement
for the existing workarounds, which doesn't make a bad concept
any worse.

But I also see now, that Guido doesn't like these and/or constructs
at all, and maybe he doesn't want to support patches that
are helping to make a horrible concept live forever.

While I have to say that the current PEP looks much worse to
me than the original. I think we should write some real programs
with all reasonable proposed idioms and look how it looks
and feel how it feels.

I still am in favor of a then...else, and I have no problem
if an if is added, optionally.

maybe-we-should-simply-keep-our-hands-from-a-dead-end - ly y'rs

Christian Tismer             :^)   <mailto:tismer at>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship*
14109 Berlin                 :     PGP key ->
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?

More information about the Python-list mailing list