[Python-ideas] Should a single/double quote followed by a left parenthesis raise SyntaxError?

Paul Moore p.f.moore at gmail.com
Wed Jul 15 17:48:33 CEST 2015

On 15 July 2015 at 16:40, Jacob Niehus <jacob.niehus at gmail.com> wrote:
> I recently forgot the '%' between a format string and its tuple of
> values and got "TypeError: 'str' object is not callable."
> My question is whether this should be caught as a syntax error instead
> of a runtime error.

To be honest, I'm not sure I see why this would be an improvement,
given that syntax errors ("SyntaxError: invalid syntax") have less
informative error messages than the TypeError you quote? Being caught
at compile time doesn't seem like it's a huge benefit (and in any
case, compile-time type checking is not something Python offers, in


More information about the Python-ideas mailing list