18-08-2009 Steven D'Aprano <st...@remove-this-cybersource.com.au> wrote:
On Tue, 18 Aug 2009 10:04:36 -0400, John Posner wrote:
[snip]
How about this:
excessblk = (Block(total - P.BASE, srccol, carry_button_suppress=True)
if total > P.BASE else
None)
If you insist on using the conditional expression, my preference would
be:
excessblk = (
Block(total - P.BASE, srccol, carry_button_suppress=True)
if total > P.BASE else None
)
Generally I'd prefer:
excessblk = (Block(........) if total > P.BASE
else None)
But it this case first line would be too long, then I'd try using:
excessblk = (Block(total - P.BASE, srccol,
carry_button_suppress=True) if total > P.BASE
else None)
or
excessblk = (Block(total - P.BASE, srccol, carry_button_suppress=True)
if total > P.BASE else None)
I'd use conditional expression only (rather) in situation when the first
expression-part was 'common' and the other (after else) was 'rare'.
Cheers,
*j
--
Jan Kaliszewski (zuo) <z...@chopin.edu.pl>
--
http://mail.python.org/mailman/listinfo/python-list