Nick Coghlan added the comment:
The embedded side-effects were my main concern with Scott's original patch, so
Steven's callback-based approach strikes me as a definite improvement. However,
the awkwardness of the revised calling code in main does make me wonder whether
or not this might be better implemented as a generator rather than as a
function accepting a callback:
try:
results = list(t.autorange())
except:
t.print_exc()
return 1
if verbose:
for number, time_taken in results:
msg = "{} loops -> {:.{}g} secs"
print(msg.format(number, time_taken, precision))
(Originally I had the "if verbose: print" embedded in a direct loop over
t.autorange(), but writing it that way made it immediately clear that the scope
of the exception handler was too broad, so I changed it to extract all the
results and only then print them)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6422>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com