Raymond Hettinger added the comment:

This idea is a bit at odds with the design of the rest of the time-it module 
which seeks to:

* run small snippets of code in volume rather than "trying to find bottlenecks 
in large programs without interfering with their operation".  The latter task 
is more suited to the profiling modules.

* run code inside a function (local variables have difference performance 
characteristics than global lookups).

* take care of running the loop for you (including repeated measurements and 
setup code) instead of your writing your own loop as done the proposed code 
fragment).

* return the output rather than print it

* minimize the overhead of the timing suite itself (using itertools.repeat  to 
control the number of loops, etc) unlike the class based version which 
introduces its own overhead.

It might still be worth having a time elapsed decorator, but I wanted to note 
that this isn't in the spirit of the rest of the module.

----------
nosy: +gvanrossum, rhettinger, tim.peters

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

Reply via email to