Unique ID numbers for compile/runtime error messages?

Eddie and Babs kca17 at dial.pipex.com
Tue Apr 24 12:30:46 EDT 2001


Does anyone agree that it would be useful for each of Python's error 
messages to have its own unique ID number?

The use of this is mainly to make it easy to look up additional descriptions
and personal notes relating to the error messages. For example, the
{Python}/Misc/cheatsheet document contains in its "Idioms and hints"
section:-

     "TypeError: call of non-function" often means a list missing a comma



There must be many similar examples. We all have such pieces of wisdom about
what errors actually "mean" in our heads, but it is difficult to write them
down and they are difficult to share with others. It is probably not a good
idea to try to build such descriptions into the error messages themselves,
as they often have relevance only in certain contexts and to certain people
(eg, some people are prone to missing out commas, others are not; name
errors may happen to students because they miss out quotes, but happen to
former Pascal programmers because they aren't used to case-sensitivity).

What I am suggesting is that each Python error message string be given a
unique number. Then, when the error occurs, the error number could be
appended to the message, preferably in a fixed format (three digits with
leading zeros, say). So we might have:-

    TypeError: call of non-function (#025)

...indicating that this was error message number 025. The poor victim of
this error could then look up its description by the number. This is much
easier than trying to find the raw message text in a list. It would be
straightforward, say, to include an ordered list of error messages and
common solutions/meanings at the back of a set of class notes for students.
And it would also be easy to write a program to look up the fixed format
number in a database and display a description along with a user's own
additional notes. It might even be possible to redirect "stderr" to an
object which retrieves the expanded error description automatically, or
records statistics about how frequently each error type occurs, etc.


What do you all think?

&.



More information about the Python-list mailing list