Roundup Robot added the comment:
New changeset 0c298f1ee3f6 by Yury Selivanov in branch 'default':
Issue 20691: Add follow_wrapped arg to inspect.signature/from_callable.
https://hg.python.org/cpython/rev/0c298f1ee3f6
--
nosy: +python-dev
___
Python
Yury Selivanov added the comment:
Closing this one.
--
resolution: - fixed
stage: - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20691
___
Nick Coghlan added the comment:
I like the idea of the following signature:
def signature(callable, *, follow_wrapped=True):
...
I'm less convinced about exposing the flag to optionally show the first
positional arg for bound methods, as that's currently specific to method
Yury Selivanov added the comment:
Do you think it's OK if I drop them?
Dropping == DeprecationWarning
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20691
___
Yury Selivanov added the comment:
Nick,
However, as noted, I doubt the latter is worth it - let's just expose the
flag to decide whether to resolve wrapper chains or not, and leave the
inclusion of the already bound value in the reported signature solely as a
legacy behaviour of
Yury Selivanov added the comment:
Nick, what do you think of this one?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20691
___
___
Yury Selivanov added the comment:
So... should we expose two keyword only parameters for
Signature.from_callable() and signature():
- 'follow_wrapped=True' to follow __wrapped__ chains;
- 'keep_bound_arg=False' to skip/include first bound arg?
--
New submission from Yury Selivanov:
In the issue #20684, Nick had an idea of exposing 'follow_wrapper_chains'
option to the public API. This might be actually very useful.
--
assignee: yselivanov
messages: 211668
nosy: larry, ncoghlan, yselivanov
priority: normal
severity: normal