Code formatting question: conditional expression
bruno.42.desthuilliers at websiteburo.invalid
Wed Aug 19 15:48:48 CEST 2009
Richard Brodie a écrit :
> "John Posner" <jjposner at optimum.net> wrote in message
> news:mailman.26.1250604346.2854.python-list at python.org...
>> if total > P.BASE:
>> excessblk = Block(total - P.BASE, srccol, carry_button_suppress=True)
>> excessblk = None
> 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 which case the last param is possibly redundant - the Block object
knows its size, so it might be able to know by itself if it's empty.
NB : please notice the 'possibly' and 'might' cautions !-)
More information about the Python-list