Cleaning up conditionals

Michael Torrie torriem at gmail.com
Fri Dec 30 21:28:39 EST 2016


On 12/30/2016 05:26 PM, Deborah Swanson wrote:
> I'm still wondering if these 4 lines can be collapsed to one or two
> lines.

If the logic is clearly expressed in the if blocks that you have, I
don't see why collapsing an if block into one or two lines would even be
desirable.  Making a clever one-liner out of something isn't always a
good thing.  In fact some programmers don't like to use the ternary
operator or conditional expressions, preferring to use explicit if block
logic.



More information about the Python-list mailing list