This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients draghuram, ethan.furman, ncoghlan, pitrou, poke, steven.daprano
Date 2010-12-27.21:37:33
SpamBayes Score 1.7693195e-06
Marked as misclassified No
Message-id <1293485857.86.0.678566183543.issue6210@psf.upfronthosting.co.za>
In-reply-to
Content
I like MRAB's suggestion best:

MRAB wrote:
> Suggestion: an explicit 'raise' in the exception handler excludes the
> context, but if you want to include it then 'raise with'. For example:
>
> # Exclude the context
> try:
>     command_dict[command]()
> except KeyError:
>     raise CommandError("Unknown command")
>
> # Include the context
> try:
>     command_dict[command]()
> except KeyError:
>     raise with CommandError("Unknown command")

I think we can even strike off the verbiage "in the exception handler"... that way, raise always does the same thing -- raise KeyError will raise a KeyError, always, not sometimes a KeyError and sometimes a KeyError nested in a WhatEverError.
History
Date User Action Args
2010-12-27 21:37:38ethan.furmansetrecipients: + ethan.furman, ncoghlan, pitrou, draghuram, steven.daprano, poke
2010-12-27 21:37:37ethan.furmansetmessageid: <1293485857.86.0.678566183543.issue6210@psf.upfronthosting.co.za>
2010-12-27 21:37:34ethan.furmanlinkissue6210 messages
2010-12-27 21:37:33ethan.furmancreate