Message193834
Based on recent python-list posts, there is also 'break is bad' propaganda going around. Perhaps we should say that loop-and-a-half with break is preferred (or at least equally acceptable) to repeating code.
while True:
value = getvalue()
if not value:
break
process(value)
versus
value = getvalue()
while value
process(value)
value = getvalue()
The latter has the problem that the getvalue code can get out of synch, and indeed, given the alternative of writing it once, it is not obvious that it should be the same in the two places. |
|
Date |
User |
Action |
Args |
2013-07-28 17:06:02 | terry.reedy | set | recipients:
+ terry.reedy, lemburg, gvanrossum, barry, rhettinger, ncoghlan, michael.foord |
2013-07-28 17:06:02 | terry.reedy | set | messageid: <1375031162.24.0.39585136605.issue18472@psf.upfronthosting.co.za> |
2013-07-28 17:06:02 | terry.reedy | link | issue18472 messages |
2013-07-28 17:06:02 | terry.reedy | create | |
|