[Python-3000] Pre-peps on raise and except changes

Nick Coghlan ncoghlan at gmail.com
Mon Feb 12 10:35:29 CET 2007


Guido van Rossum wrote:
> Somehow it seems that exceptions keep getting permission to violate
> the rules... (E.g. the insistence on a fixed base class is also
> considered unpythonic in other contexts.) Maybe it's because they're
> "exceptions" ? :-)
> 
> Anyway, I believe there's a use case for re-raising an existing
> exception with an added traceback. After all the __traceback__
> attribute is mutable. Returning the mutated object is acceptable here
> because the *dominant* use case is creating and raising an exception
> in one go:
> 
>  raise FooException(<args>).with_traceback(<tb>)

Works for me.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list