On Wed, Jun 13, 2012 at 8:06 PM, Yury Selivanov <yseliva...@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@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) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com