PEP 308: A PEP Writer's Experience - PRO

Andrew Dalke adalke at mindspring.com
Tue Feb 11 14:30:46 EST 2003


Erik Max Francis:
> Using a conditional operator as the sole expression in the conditional
> of an if statement is pretty bad style in any language.  My point about
> it being red herring is that this is simply a general style issue in any
> language, not just Python.  I suspect that its use will be very rare in
> Python, just like it is in C, C++, Java, or Perl.

Sure, and most people will at the very least write it in parens, as

  if (x if y else z):

And I agree that its use will be rare.  I just think it will also be
used incorrectly (when other more appropriate Python idioms
are available) about 1/3 of the time.  C/C++ idioms dominate
how many people think about programs, and so those constructs
will come to mind often before the Python ones, even for people
who are good Python programmers.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list