A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-June/120033.html below:

[Python-Dev] Updated PEP 362 (Function Signature Object)

[Python-Dev] Updated PEP 362 (Function Signature Object) [Python-Dev] Updated PEP 362 (Function Signature Object)Nick Coghlan ncoghlan at gmail.com
Thu Jun 7 15:42:57 CEST 2012
On Thu, Jun 7, 2012 at 11:28 PM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
>> We'll probably extend it to copy __signature__ too; then 'signature(decor(f))'
>> will be the same as 'signature(f)'.
>
> I don't think functools.wraps can copy the signature by default - it's not uncommon to have decorators that modify signatures. A new parameter to functools.wraps defaulting to False?

Most wrapped functions already report the wrong signature under
introspection anyway (typically (*args, **kwds)). Following the
__wrapped__ chains by default will produce an answer that is more
likely to be correct in such cases.

The big win from my point of view is that thanks to __signature__,
decorators that modify the signature will now have the opportunity to
retrieve the signature from the underlying function and accurately
report a *different* signature.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4