[Python-Dev] PEP for allowing 'raise NewException from None'
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:
- should 'raise ... from ...' be legal outside a try block?
- should 'raise ... from None' be legal outside a try block?
More information about the Python-Dev