[docs] [issue15248] Better explain "TypeError: 'tuple' object is not callable"

Serhiy Storchaka report at bugs.python.org
Wed Mar 21 14:59:34 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Actually the precedence was a warning for an assert like:

    assert(x % 2 == 0, "x is odd")

Currently it is the only syntax warning produced by the compiler.

> 1. Why 'chech' instead of 'check'?

Just a typo replicated with a copy-paste.

> 2. Will chech_index catch "[1,2] [3,4]"? (I am guessing that is the intent.)

Yes, it is. It could be extended to catch also "['foo','bar'] ['baz']".

> 3. Does Syntax Warning stop compilation, or at least execution, as at a >>> prompt?

No, it is just a warning unless you run Python with -Werror.

This patch was inspired by usability improvements in GCC 8 [1]. I haven't created a pull request because I have doubts about that this should be in the compiler rather of a third-party linter. But if several other core developers will support this idea I'll continue working in this direction.

[1] https://developers.redhat.com/blog/2018/03/15/gcc-8-usability-improvements/

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue15248>
_______________________________________


More information about the docs mailing list