For review: PEP 308 - If-then-else expression

Dave Brueck dave at
Sat Feb 8 23:00:33 CET 2003

On Sat, 8 Feb 2003, Andrew Dalke wrote:

> Sean Ross:
> > Mostly, I just wanted to avoid a specific edge case someone mention much
> > earlier in the thread:
> >
> >     if x if C else y:
> > stuff...
> Hmm... what if Python generates a "EleganceWarning" when it gets
> an if expression in an if statement, or embedded if expressions?

Actually, I've been wondering if something like PyChecker (or even a
special mode of PyChecker) would be useful in checking your code against
generally accepted style guides. You could obviously shut off "Warnings"
you're not interested in, but it could look at your code and point out
things we generally consider to be bad:

- naming 'self' something else
- too small or too large indendation, or mixed (e.g. using 3 spaces in
some functions, 4 in others)
- abusing the if-expressions
- ...


More information about the Python-list mailing list