Skip to content

Conversation

@jdemeyer
Copy link
Contributor

@jdemeyer jdemeyer commented Aug 14, 2019

Copy link
Contributor

@epicfaace epicfaace left a comment

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
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
Copy link
Contributor

epicfaace commented Aug 23, 2019

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants