Ben Longbons <b.r.longb...@gmail.com> added the comment:

This kind of "debug your code" is the kind of thing I've gotten used to from 
the Clang C/C++ compiler. Granted, compiled languages have an advantage here, 
but enough residual information remains for the interpreter at runtime.

And I am in no way suggesting that *every* attempt to call a non-function have 
the extra information.

For the cases where the error message is given, something like:
TypeError: 'tuple' object is not callable (missing preceding comma?)

The case of a homogenous container is the most important case.

I've offered two different ways to figure out whether it's a typo or an attempt 
to call an object that you honestly think is callable:
1. Is the called object a newly-constructed (refcount=1) tuple literal? (Also 
works for list, set, and dictionary literals; probably wouldn't work for string 
literals due to interning)
2. Does the false call occur within a container literal or function call?

I'm not intimately familiar with python bytecode or interpreter, but I'm sure 
anyone who is could extract this information.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15248>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to