[Python-ideas] Structured Error Output

Bryce Boe bboe at cs.ucsb.edu
Thu Apr 26 02:30:45 CEST 2012


> Correct. And it isn't a problem, because it shouldn't matter if the
> programmer wrote a bit of code that caused the compiler to raise a
> syntax error, raised the syntax error themselves, evaled a string that
> raised the syntax error, or wrote the message explicitly to standard
> error: all those cases represent a syntax error to the programmer.

Perhaps you cannot envision a case where it matters because you don't
work with people that intentionally try to cheat or mislead a system.
I am merely pointing out that currently there is no way to distinguish
between these behaviors, and I would personally like to add that
support because I have a need to deterministically differentiate
between them. I don't want to break backwards compatibility, so what I
propose would only take place via a command line argument.
>> This "channel" sharing of control (error messages) and data is a
>> problem that affects more than just the python interpreter. I am
>> hoping to start with python and provide a way to separate the control
>> and data information so I can be certain that output on the "control"
>> file descriptor is guaranteed to be generated by the interpreter.
>> If your program is writing *data* to stderr, it's badly designed. You
> should fix it instead of trying to get Python changed to accommodate
> it.

That is a generalization which is not true. Counter example: I have
students writing a simple interpreter in python and their compiler
should output syntax errors to stderr when the program their
interpreter is interpreting. Now say their errors looks very similar
to python errors, how does one distinguish between an error in their
implementation of their interpreter, or an error raised by their
interpreter?
Furthermore, having this separation is somewhat pointless without the
structured part, as ideally I would like it if all compilers and
interpreters produced similar output so I could easily measure how
many errors beginning programmers have in various languages and group
them by type. I have to start somewhere with this project and I was
hoping the python community would be in favor of adding such support
as I feel the changes are relatively trivial.
-Bryce


More information about the Python-ideas mailing list

AltStyle によって変換されたページ (->オリジナル) /