PEP-308 a "simplicity-first" alternative

Christian Tismer tismer at tismer.com
Thu Feb 13 04:42:34 CET 2003


Gerd Woetzel wrote:
> Hi,
> 
> I cannot resist. This is the first (and only)  proposal that I would support:
> 
> holger krekel <pyth at devel.trillke.net> writes:
...

>>       x and y else z

Dear Gerd,
I have been thinking the same, while I liked a "then" form better,
but didn't care. I was all for it.

After sleeping over it several times, I found out that
I now totally disagree.

This is a very elegant cure to a very bad concept.
We have become used to use and/or in Python when we don't mean it.
This has been wrong from the beginning, since if written correctly,
all the phrases used to spell "if then else" are an abuse of
the logical operators.
In the proposed ternary operator, "and" does not in any way
really mean "and", and this is absolutely unpythonic.
We should write what we mean. Tricks to achieve an effect
are locally ok, but modifying the language to eternalize the
tricks is not doing any good to us and Python.

So, now I'm saying, if there is an "and", it should mean "and",
and not "then".
We should not invent new escapes to trick "and" into behaving
like "then", by cheating the right operand, or by doing magic
to "and" by a ternary operator rule.
The word "and" is abused, and so are all who have to read the code.

Havig that said, I'm not against a ternary operator. If we
want to need conditional expressions with else parts,
a ternary is not avoidable.

Given the syntactic gymnastics from the latest PEP308 version,
I believe the BDFL just gives us something nasty enough
to disagree with, which I hereby do whole-heartedly.

getting-nothing-is-better-than-getting-worse -- 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