3 ms·
That seems incredibly silly, and looks like it could lead to very infrequent bugs (the worst kind). `while True` is shorter, simpler, and conveys the actual pur
by meowface 13y ago
That seems incredibly silly, and looks like it could lead to very infrequent bugs (the worst kind). `while True` is shorter, simpler, and conveys the actual purpose better.
Maybe having a statement like that when testing is okay, but in production code that looks insane.
- falcolas 13y agoI'd argue that `while True` would be fine in testing, but problematic for production, particularly in the types of programs I write most frequently (long running, minimal supervision). In these daemons, stalling on infinite loops is significantly more painful than dropping out of a loop early occasionally (and with proper logging that it did fall out of the loop, to boot). It's certainly not as idiomatic, but it's more correct in the long run. My eyes were opened to this when reading through the NASA C guidelines. Closing the door on infinite loops lets programs recover gracefully and do the correct thing for the duration of the programming, as opposed to thing that may be correct for that moment of operation: i.e. looping 1-2 more times beyond the limits of the xrange counter.