-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-108901: Add bound_arg
to Signature.from_callable()
and signature()
#116559
base: main
Are you sure you want to change the base?
Changes from all commits
290e1ad
2e36181
a0ed116
470625f
8f6424a
4f08ab7
d76ba71
e30aeb2
4d5a96e
3b884eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -521,6 +521,15 @@ io | |
built on debug mode <debug-build>`. | ||
(Contributed by Victor Stinner in :gh:`62948`.) | ||
|
||
inspect | ||
------- | ||
|
||
* Add *bound_arg* parameter to :func:`inspect.Signature.from_callable` | ||
and :func:`inspect.signature`: keep the ``self`` parameter | ||
in the method signature if *bound_arg* is True. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reword here to match the updated main function docs (including mentioning the getfullargspec compatibility) |
||
:pypi:`inspect313` package has a backport of this feature. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe make the backport mention a seealso note in the module docs rather than only putting it here? |
||
(Contributed by Nikita Sobolev in :gh:`108901`.) | ||
|
||
ipaddress | ||
--------- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Add *bound_arg* keyword-only parameter to | ||
:func:`inspect.Signature.from_callable` and :func:`inspect.signature`. | ||
If *bound_arg* is ``True``, keep ``self`` parameter in method a signature. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mention the getfullargspec compatibility aspect here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to describe the non-default behaviour for boolean options (so folks know what they'll get if they request non-default behaviour):
(Describing both behaviours is also an option, but it seemed excessively verbose in this case)