Author gvanrossum
Recipients eric.araujo, gvanrossum
Date 2013-02-09.00:16:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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):

def myfunc(args):
Date User Action Args
2013-02-09 00:16:18gvanrossumsetrecipients: + gvanrossum, eric.araujo
2013-02-09 00:16:18gvanrossumsetmessageid: <>
2013-02-09 00:16:18gvanrossumlinkissue17130 messages
2013-02-09 00:16:17gvanrossumcreate