On Wed, Jul 1, 2009 at 2:14 AM, David Hirschfield <dav...@ilm.com> wrote:
> Unfortunately that still requires two separate decorators, when I was > hoping there was a way to determine if I was handed a function or method > from within the same decorator. > > Seems like there really isn't, so two decorators is the way to go. > Thanks, > -David > > This is a really horrible idea, but it may work: If you can rely on your code using the word "self", you could use the inspect module to look at the arguments of the function being decorated, and dispatch based on that. The idea itself feels extremely dirty though.
-- http://mail.python.org/mailman/listinfo/python-list