[issue19495] Enhancement for timeit: measure time to run blocks of code using 'with'

Guido van Rossum report at bugs.python.org
Mon Jun 16 05:04:51 CEST 2014


Guido van Rossum added the comment:

FWIW, I definitely don't think this belongs in the timeit module, unless you are going to treat that module as a "namespace" package, which I don't like much (though in Java I think it's a pretty common pattern). If we have to have it, contextlib sounds fine (it's a grab-bag already). The sub-idea of a context manager to disable gc (or perhaps manipulate other state of the gc module) sounds fine even if you follow my recommendation not to add the timer context manager to the stdlib.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19495>
_______________________________________


More information about the Python-bugs-list mailing list