[Python-Dev] PEP 409 update [was: PEP 409 (original) (raw)
Ethan Furman ethan at stoneleaf.us
Fri Feb 3 18:48:34 CET 2012
- Previous message: [Python-Dev] PEP 409 update [was: PEP 409 - final?]
- Next message: [Python-Dev] PEP 409 update [was: PEP 409 - final?]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Barry Warsaw wrote:
raise e from ...
is certainly cute, but not very informative. Triple-dots will be confusing and difficult to read in documentation and code, and Ellipsis has no logical connection to the purpose of this PEP. So while I'm +1 on everything else in the PEP, I'm -1 on this particular decision. One of the alternatives states: Create a special exception class, NoException. Rejected as possibly confusing, possibly being mistakenly raised by users, and not being a truly unique value as None, True, and False are. I think this should be revisited. First,
_NoException_
doesn't need to be an exception class. Ellipsis isn't so this doesn't need to be either. I have no problem adding a new non-exception derived singleton to mark this. And while NoException may be a little confusing, something like NoCause reads great and can't be mistaken for a raiseable exception.
The problem I have with names like NoException, NoCause, NoWhatever is that is sounds a lot like None -- in otherwords, like there won't be any chaining.
So your example would then be:
try: try: raise IndexError() except: raise CustomError() from None except CustomError as e: # nevermind, let's see the whole thing after all raise e from NoCause
If we do switch from Ellipsis to something else I think a name like Chain would be more appropriate. Or ExcChain.
raise e from ExcChain
Less cute, but probably less confusing.
Ethan
- Previous message: [Python-Dev] PEP 409 update [was: PEP 409 - final?]
- Next message: [Python-Dev] PEP 409 update [was: PEP 409 - final?]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]