This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author o11c
Recipients eric.araujo, o11c, steven.daprano
Date 2012-07-06.04:46:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1341549975.91.0.176622862713.issue15248@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012-07-06 04:46:15o11csetrecipients: + o11c, eric.araujo, steven.daprano
2012-07-06 04:46:15o11csetmessageid: <1341549975.91.0.176622862713.issue15248@psf.upfronthosting.co.za>
2012-07-06 04:46:15o11clinkissue15248 messages
2012-07-06 04:46:14o11ccreate