On 29 November 2016 at 20:38, Nathaniel Smith
On Tue, Nov 29, 2016 at 1:05 AM, Victor Stinner
wrote: Hi,
Python is optimized for performance. Formatting an error message has a cost on performances.
Sure, but we have to look at this on a case-by-case basis. Is there really important code out there that's generating NameErrors or SyntaxErrors in an inner loop? That seems unlikely to me.
Right, we generally treat error message formatting code as being off the critical performance path. In many (most?) cases, the instances of uninformative error message are just a symptom of the code in question being really *old*, such that it predates the great many improvements made to the low level error reporting machinery over the years. That's not always true (e.g. parser errors are uninformative because the parser doesn't keep track of the state needed to generate nicer messages), but it seems to typically be true for runtime errors where we don't even report the type or representation of a misbehaving value. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia