Hello, On Tue, 20 Apr 2021 18:23:15 -0000 "Pol Welter" <polwel...@gmail.com> 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'. > > There are situations (e.g. monkey patch) where this is not obvious. > Would be great detail to include that in the traceback, I think. That was reported some time ago: https://groups.google.com/g/dev-python/c/xdcpSJN17QQ https://groups.google.com/g/python-ideas/c/3jEZ9F-oUr0 Just as you, I had hard time to believe that wasn't fixed over 30 years of CPython history. I fixed that in my Python dialect, https://github.com/pfalcon/pycopy , and enjoyed it thoroughly on multiple occasions since then. For the snippet above (put in a file): Traceback (most recent call last): File "ex.py", line 4, in <module> File "ex.py", line 2, in foo TypeError: foo() takes 2 positional arguments but 3 were given -- Best regards, Paul mailto:pmis...@gmail.com _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@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/65SERA4KSUWCPXP2XPLIMIKAFHKMHIDC/ Code of Conduct: http://python.org/psf/codeofconduct/