Terry J. Reedy added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18472>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to