[Python-Dev] PEP for allowing 'raise NewException from None'

Guido van Rossum guido at python.org
Fri Jan 27 06:51:35 CET 2012


On Thu, Jan 26, 2012 at 9:18 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> I've been burnt by too much code that replaces detailed, informative
> and useful error messages that tell me exactly what is going wrong
> with bland, useless garbage to be in favour of an approach that
> doesn't even set the __context__ attribute in the first place.

Ditto here.

> If __context__ is always set regardless, and then __cause__ is used
> to control whether or not __context__ gets displayed in the standard
> tracebacks, that's a much more flexible approach.

Well, but usually all you see is the printed traceback, so it might as
well be lost, right? (It gives full control to programmatic handlers,
of course, but that's usually not where the problem lies. It's when
things go horribly wrong in the hash function and all you see in the
traceback is a lousy KeyError. :-) Did you consider to just change the
words so users can ignore it more easily?

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list