Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

bpo-37645: simplify __str__ of function objects#15295

Closed
jdemeyer wants to merge 1 commit into
python:mainpython/cpython:mainfrom
jdemeyer:function_strjdemeyer/cpython:function_strCopy head branch name to clipboard
Closed

bpo-37645: simplify __str__ of function objects#15295
jdemeyer wants to merge 1 commit into
python:mainpython/cpython:mainfrom
jdemeyer:function_strjdemeyer/cpython:function_strCopy head branch name to clipboard

Conversation

@jdemeyer

@jdemeyer jdemeyer commented Aug 14, 2019

Copy link
Copy Markdown
Contributor

@epicfaace 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.

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)

@jdemeyer

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

epicfaace commented Aug 23, 2019

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

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 github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 7, 2026
@vstinner

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 vstinner closed this Apr 7, 2026
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.