(original) (raw)


On Jun 14, 2012 2:31 PM, "Alexandre Zani" <alexandre.zani@gmail.com> wrote:

> Why do we look at \_\_wrapped\_\_ only if the object is a FunctionType?
> Why not support \_\_wrapped\_\_ on all callables?

Fair question - duck typing here makes more sense to me, too.

>
> Why special-case functools.partial? Couldn't functools.partial just
> set \_\_signature\_\_ itself? Is that because of inspect's dependency on
> functools?

Got it in one. Really, it's the same reason we don't burden the builtin callable machinery with it - to ensure the dependencies only flow in one direction.

> Just a thought: Do we want to include the docstring? A function's
> docstring is often intimately tied to its signature. (Or at least, a
> lot of us try to write docstrings that effectively describe the
> function's signature)

No, combining the signature with other details like the name and docstring is the task of higher level interfaces like pydoc.

Cheers,
Nick.

--
Sent from my phone, thus the relative brevity :)