FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-37645: simplify __str__ of function objects by jdemeyer · Pull Request #15295 · python/cpython · GitHub

/ cpython Public

bpo-37645: simplify __str__ of function objects - #15295

Closed
jdemeyer wants to merge 1 commit into
python:mainfrom
jdemeyer:function_str
Closed

bpo-37645: simplify __str__ of function objects#15295
jdemeyer wants to merge 1 commit into
python:mainfrom
jdemeyer:function_str

Conversation

jdemeyer commented Aug 14, 2019
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

epicfaace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Would repr(f) when f takes arguments also look like f()? In that case, it might be misleading (it would look like f takes no arguments)

Copy link
Copy Markdown
Contributor Author

I'm not changing repr(f) at all, only str(f). But yes, str(f) will always be f() regardless of the signature. Note that neither repr(f) nor error messages involving f write the signature, so I don't plan to add the signature either.

>>> def f(a, b): pass
>>> f
<function f at 0x7f9c6e259160>
>>> f(**1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() argument after ** must be a mapping, not int

epicfaace commented Aug 23, 2019
edited
Loading

Copy link
Copy Markdown
Contributor

Sorry, I meant str(f). My concern was just that printing out f() may cause the misleading impression that f takes no arguments, while that is not the case for <function f at 0x7f9c6e259160> (because it has no parentheses).

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 7, 2026

vstinner commented Apr 7, 2026

Copy link
Copy Markdown
Member

I don't think that this change is a good idea: #81826 (comment). There is no activity for 7 years, I close the issue.

vstinner closed this Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL