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-112139: Add inspect.Signature.format
and use it in pydoc
#112143
Conversation
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.
Thanks, it's great this is relatively simple to implement.
Should we make this a public, supported feature of inspect.signature
? It may be useful for users other than pydoc
. For example, we could add a __format__
. Then perhaps something like f"{sig:78p}"
could be used.
Yes, I think we should add a new method called |
pretty
to inspect.Signature
and use it in pydoc
inspect.Signature.format
and use it in pydoc
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.
Thank you! Sorry I forgot about reviewing this PR.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Wow, this is going to be a big quality-of-life improvement. Thanks @sobolevn and @JelleZijlstra! :D |
…python#112143) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
What do you think about
__str__
with a parameter? Or should we add an alias for this, likedef to_string(self, *, pretty)
?