On 1/20/2012 7:40 PM, Steven D'Aprano wrote: > Benjamin Peterson wrote: >> 2012/1/20 Terry Reedy <tjreedy at udel.edu>: >>> Since 'raise' means 're-raise the current error', 'raise as OtherError' >>> means (clearly to me, anyway) 're-raise the current error as >>> OtherError'. >> >> That doesn't make any sense. You're changing the exception completely >> not reraising it. > > I expect Terry is referring to the coder's intention, not the actual > nuts and bolts of how it is implemented. Yes, same error situation, translated, typically from developer language to app language. > def spam(): > try: > something() > except HamError: > raise SpamError > > is implemented by catching a HamError and raising a completely different > SpamError, but the intention is to "replace the HamError which actually > occurred with a more appropriate SpamError". > > At least that is *my* intention when I write code like the above, and it > appears to be the usual intention in code I've seen that uses that > idiom. Typically SpamError is part of the function's API while HamError > is not. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4