[Python-Dev] PEP 409 and the stdlib

Hrvoje Niksic hrvoje.niksic at avl.com
Tue May 21 11:28:33 CEST 2013


On 05/21/2013 10:36 AM, Serhiy Storchaka wrote:
>>      The above exception was converted to the following exception:
>>      ...
>>
>> That makes it clear that the conversion was explicit and (hopefully)
>> intentional, and that the latter exception supersedes the former.
>
> How do you distinguish intentional and unintentional exceptions?

By the use of the "raise" keyword.  Given the code:

try:
     x = d['key']
except KeyError:
     raise BusinessError(...)

...the explicit raising is a giveaway that the new exception was quite 
intentional.

Hrvoje



More information about the Python-Dev mailing list