For review: PEP 308 - If-then-else expression
gustav at morpheus.demon.co.uk
Sun Feb 9 00:07:10 CET 2003
holger krekel <pyth at devel.trillke.net> writes:
> Andrew Koenig wrote:
>> Erik> That's exactly my view, as well. I would prefer `if p then x
>> Erik> else y', but if an extra keyword is absolutely contradindicated,
>> Erik> then I'll settle for `x if p else y'. I just want the
>> Erik> functionality, I can learn to use the syntax.
>> I find one aspect of this discussion particularly interesting:
>> Most of the people in favor of PEP 308 have a pretty good idea of the
>> contexts in which they want to use conditional expressions.
>> Most of the people opposed to PEP 308 are giving purely subjective
>> reasons, disliking the whole idea so much that not only do they not
>> want to use it, but they want to prevent other people from doing so as
> Let me guess which side you lean on :-)
> Actually, in my book people gave quite some good reasons
> for opposing the PEP:
Agreed, on all of these.
Also, the people in favour may know where they want to use conditional
expressions, but when challenged with alternative ways of expressing
their code, the response usually boils down to "but I don't like
that". Which is not an invalid response, but it does emphasize the
fact that *neither* side of the debate has any particularly killer
It's all a matter of personal preference.
>> I've seen conflicts like this in other contexts; they're often a
>> symptom of two subsets of the community that come from different
>> backgrounds and want to program in different styles.
> I have often seen people claiming that other people's objections
> are just based on irrational feelings whereas themselves they
> would have well-founded oppinions :-)
Just as long as we're all clear here that *both* sides' arguments are
based on irrational feelings in this case :-)
> More seriously, though, i think you are right about pythoneers
> coming from different backgrounds. But it's important to
> settle on a *minimal* set of syntax and not combine all the
> wishes from all "groups" which would greatly decrease readability
> of other's source code.
It's important not to turn this argument into some sort of license to
tell other how to code "for their own good". But there is a
significant point here - whether you like it or not, Python is not
about diversity for its own sake. That's Perl's game :-)
To quote the interpreter itself:
>python -c "import this" | grep way
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
The conditional expression does not add any new abilities to the
language. So it's never the "... only one --obvious way". But I'm not
Dutch, so what do I know :-)
This signature intentionally left blank
More information about the Python-list