Guido van Rossum added the comment:
While we're on profile convenience features, how about adding two context
managers:
- one that just profiles a block and prints the profile (or dumps the data to a
file)
- one that takes a Profile instance and enables profiling to that instance
E.g. (1)
with cProfile.runblock([file]):
<your code here>
or (2)
p = cProfile.Profile()
with p:
<your code here>
Also a decorator corresponding to (1):
@cProfile.runfunc([filename])
def myfunc(args):
<stuff>
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17130>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com