[Python-Dev] PEP for allowing 'raise NewException from None'
Ethan Furman
ethan at stoneleaf.us
Fri Jan 27 18:08:40 CET 2012
Guido van Rossum wrote:
> Did you consider to just change the
> words so users can ignore it more easily?
Yes, that has also been discussed.
Speaking for myself, it would be only slightly better.
Speaking for everyone that wants context suppression (using Steven
D'Aprano's words): chained exceptions expose details to the caller that
are irrelevant implementation details.
It seems to me that generating the amount of information needed to track
down errors is a balancing act between too much and too little; forcing
the print of previous context when switching from exception A to
exception B feels like too much: at the very least it's extra noise; at
the worst it can be confusing to the actual problem. When the library
(or custom class) author is catching A, saying "Yes, expected, now let's
raise B instead", A is no longer necessary.
Also, the programmer is free to *not* use 'from None', leaving the
complete traceback in place.
~Ethan~
More information about the Python-Dev
mailing list