PEP 308: Alternative conditional operator forms

Dave Brueck dave at pythonapocrypha.com
Tue Feb 11 11:58:42 EST 2003


On Tue, 11 Feb 2003, Robin Munn wrote:

> OTOH, I'm not entirely convinced myself that it's necessary to require
> the parentheses. Good style will demand that they be there, yes. And
> I'll strongly recommend them to newbies who ask for help with their code
> six months down the line.

And I think that this attitude is key: any new language feature should
include some "good style" guidelines that, while not enforced by the
language, carry nearly the same weight. This is especially important when
the PEP needs to list, for clarity and completeness, what happens in
oddball use cases - a style section balances what's possible with what's
reasonable.

A lot of arguments against the PEP deal with odd abuses of the feature,
but IMO they overexaggerate the risks there. Most developers with even a
little discipline will avoid such uses, and if they don't care about good
style then they will write sloppy code despite what the language
encourages.

If your company has a coding standard _and_ abuse becomes a problem, you
can add it to your coding standard (with emphasis on waiting for it to
really become a problem). At my current job we don't have a formal
standard at all, but every once in awhile we'll make style suggestions to
each other and it's the end of the issue. Not a big deal!

-Dave





More information about the Python-list mailing list