I've been doing a lot of debugging lately, and have been using this bit of code to great effect:
from traceback import extract_stack, format_list
ti = 0.0
class rec:
def __init__(self):
self._his = []
def __setattr__(self, key, value):
if key != '_his':
self._his.append((key, value, ti, extract_stack()[:-1]))
self
(
Read more... )
Comments 5
(The comment has been removed)
http://docs.python.org/whatsnew/2.6.html#pep-3129-class-decorators
And on earlier versions you could always just use: SomeClass = some_decorator(SomeClass)
Reply
Reply
Reply
Reply
Reply
Leave a comment