On Tue, Feb 23, 2021 at 10:10 AM Stestagg <stest...@gmail.com> wrote:
> So Python has identified that a function 'do_thing' is being called 
> incorrectly, but /where/ is do_thing defined?   This problem gets much harder 
> if there are multiple definitions of 'do_thing' in the codebase, as alluded 
> to in the original mail.
>
> Paul's suggestion is that python should add the source location of the 
> function being called into the error message somewhere.
>

Thank you for explaining. I'm glad I wasn't the only one confused by
the original post :)

I think this is a nice-to-have, rather than being a serious bug to be
fixed. When you get an error about a function call, it's entirely
possible that the target function is the problem, or that the wrong
function is being referenced; but you can get similar problems with
all kinds of mismatches (like "a, b, c = thing" and getting a
ValueError - maybe you'd need to check the line where 'thing'
originated).

If this can be done easily, great, but otherwise it might be the
domain of traceback enhancement tools rather than the core language.

Does execution ever (in the normal case) actually hit the 'def' line?
If so, I wouldn't be averse to having a traceback line mentioning it.
But if (as I suspect) tracing successful execution wouldn't hit that
line, then it doesn't seem right to feign execution of it. My
understanding of the def statement is that it runs ONLY when the
function is defined; when the function's called, you go straight into
the body.

ChrisA
_______________________________________________
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/6G6Q45XYZOFA7BMHDLJUO4R6AX5UJVDM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to