[Python-Dev] PEP for allowing 'raise NewException from None' (original) (raw)

Ethan Furman ethan at stoneleaf.us
Sat Jan 28 01:33:21 CET 2012


Terry Reedy wrote:

The PEP does not address the issue of whether the new variation of raise is valid outside of an except block. My memory is that it was not to be and I think it should not be. One advantage of the 'as' form is that it is clear that raising the default as something else is invalid if there is no default.

Were you speaking of the original (PEP 3134), or this new one (PEP 409)?

Because at this point it is possible to do:

 raise ValueError from NameError

outside a try block. I don't see it as incredibly useful, but I don't know that it's worth making it illegal.

So the question is:

Ethan



More information about the Python-Dev mailing list