Properties, Methods, Events
Fredrik Lundh
fredrik at pythonware.com
Tue May 8 12:33:37 EDT 2001
John Flynn wrote:
> > Do you know of any way to trap an ordinary method call? Eg. if Time-
> > Bomb has a method 'tick', can we find a way to know automatically when
> > it is called?
>
> Ahem... On second thoughts, this goes down as the dopiest and most
> meaningless question in history.
why? assuming that you meant "... when it is called, without modifying
the method", it's a rather interesting question.
(hint: let __getattr__ return a proxy object if the member is callable, and
let that object call the original method from its __call__ method)
Cheers /F
More information about the Python-list
mailing list