On 22 May, 10:11, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > The version given by Peter Otten may do what you want, but I'd consider if > you really need an announce_function in the first place, given all the > other ways you already have to do the same thing. > Implicitely rebinding globals does not look good.
Thanks for the advice Gabriel. The use case I have is that I'd like to be able to decorate classes and even modules in this way: import announce import spam announce.announce_module(spam) ... code which calls into spam module Here, "announce.announce_module" has a look in "spam", finds all the functions and instancemethods, and decorates them (rebinds them) by announcing calls to these functions and instancemethods. It's something I've found useful, though clearly the behaviour of "spam" has been drastically changed. I'd appreciate advice on better ways to achieve this kind of thing, or why it doesn't look good. -- http://mail.python.org/mailman/listinfo/python-list