Code formatting question: conditional expression
John Posner
jjposner at optimum.net
Tue Aug 18 13:25:46 EDT 2009
> I wonder if it is appropriate to replace the None sentinel with one that is an instance
> of Block() e.g.
>
> size = total - P.BASE
> excessblk = Block(size, srccol, carry_button_suppress=True, empty_block=(size <= 0) )
>
In this particular case, Richard, I don't think so. The Block class is
an application-level wrapper for a graphical object. I don't want to
worry about zero-size objects. ("Is this column really empty, or does it
contain one or more zero-size blocks?") If you're interested, take a
look at "BlockHead" at www.jjposner.net.
BTW, from the (admittedly few) responses to my original post, it seems
there's some sentiment that "conditional expressions" are a non-Pythonic
misfeature. Interesting ...
-John
More information about the Python-list
mailing list