Python profiler usage with objects

harit harit.himanshu at gmail.com
Tue Jun 29 12:57:09 EDT 2010


Hi,

I have a specific question regarding the usage of profiler. I am new
to python programming I am trying to profile a function which I want
to invoke as a class method, something like this

import profile

class Class:

def doSomething():

    do here ..

def callMethod():

    **self.doSomething()**
instead of this I want to use

    **profile.run(self.doSomething())**
but the profile.run expects the string inside it and I get error

TypeError: exec: arg 1 must be a string, file, or code object

Can somebody please help?

Thank you



More information about the Python-list mailing list