Skip to content

Instantly share code, notes, and snippets.

@harlowja
Created February 5, 2016 19:47
Show Gist options
  • Save harlowja/0dc708a09e535632e6f8 to your computer and use it in GitHub Desktop.
Save harlowja/0dc708a09e535632e6f8 to your computer and use it in GitHub Desktop.
from osprofiler import profiler
def big_e():
pass
class A(object):
@staticmethod
def e():
print 'b'
def hello(self):
A.e()
# This one isn't traced
a = A()
a.hello()
my_old_e = A.e
# This one now is traced.
a = profiler.trace_cls('a')(a)
a.hello()
# And so is this one?? but with 'a' trace, huh...
b = A()
a.hello()
# Works, not traced
my_old_e()
# Doesn't barf???, but isn't traced either :-/
b.e()
# Barfs
a.e()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment