[IPython-dev] 'Unwrapping' decorated functions in IPython

Thomas Kluyver takowl at gmail.com
Fri Jul 15 10:38:03 EDT 2011


On 15 July 2011 15:27, Michele Simionato <michele.simionato at gmail.com>wrote:

> Yes, but the decorator module by design only works on true functions, not
> on objects where you can define your custom __getattr__. Your objection
> stands for callable objects but I believe IPython is able to distinguish
> callables from true functions, right?


We could check against types.FunctionType. But I'm fairly sure the functools
wrapping can be used on arbitrary callables, and it's a handy link that
other tools might make. So I'd prefer not to do that. I think the unwrapping
limit is the best idea we've had - it should only take an extra couple of
lines of code, and I don't think there's any situation where it will fall
over.

Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110715/b074249d/attachment.html>


More information about the IPython-dev mailing list