[Python-Dev] PEP 362 Third Revision (original) (raw)

Alexandre Zani alexandre.zani at gmail.com
Thu Jun 14 06:29:12 CEST 2012


On Wed, Jun 13, 2012 at 8:06 PM, Yury Selivanov <yselivanov at gmail.com> wrote:

On 2012-06-13, at 10:52 PM, Yury Selivanov wrote:

2. signature() function support all kinds of callables: classes, metaclasses, methods, class- & staticmethods, 'functools.partials', and callable objects.  If a callable object has a 'signature' attribute it does a deepcopy of it before return.

Properly decorated functions are also supported. - Yury


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/alexandre.zani%40gmail.com

This is really exciting! A couple questions/points:

Why do we look at wrapped only if the object is a FunctionType? Why not support wrapped on all callables?

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

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)



More information about the Python-Dev mailing list