
On 20/04/2021 19:23, Pol Welter wrote:
Consider the following snippet:
def foo(a, b): pass foo(1, 2, 3)
We all know what will happen.
File "<stdin>", line 4, in <module> foo(1, 2, 3) TypeError: foo() takes 2 positional arguments but 3 were given
Would it be reasonable to include the line number for the function `foo()` that it resolved the call to? I.e. 'File "<stdin>", line 1, in foo'.
And presumably the module name as well. If foo had been imported from a different module instead of defined in the current one, the line number alone would be less helpful. Rob Cliffe
There are situations (e.g. monkey patch) where this is not obvious. Would be great detail to include that in the traceback, I think.
Best Pol _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/MINLM7... Code of Conduct: http://python.org/psf/codeofconduct/