PyWart: NameError trackbacks are superfluous

Chris Angelico rosuav at gmail.com
Sat Mar 16 19:59:17 EDT 2013


On Sun, Mar 17, 2013 at 10:48 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Here's a truly trivial case where code will succeed or fail depending on
> the order of function calls.
> (chop code)
> It's not enough to know that the print line in display() fails, because
> that's merely the side-effect. The actual problem occurs in the caller,
> fail(). If NameError suppressed the traceback, that would be more
> difficult to solve.

A good example. It would be logically equivalent to set spam=None in
stop(), and nobody would expect the TypeError to omit the traceback,
so why should delling the name be any different?

ChrisA



More information about the Python-list mailing list