Author terry.reedy
Recipients docs@python, ncoghlan, terry.reedy
Date 2013-02-12.01:19:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1360631999.8.0.76627095073.issue17188@psf.upfronthosting.co.za>
In-reply-to
Content
Language manual, section 7.8. The raise statement has no mention of the 'from None' option. Indeed it says "if given, the second expression must be another exception class or instance", which would exclude None.

Library manual, Ch 5. Built-in Exceptions, says
'''
When raising a new exception (rather than using a bare raise to re-raise the exception currently being handled), the implicit exception context can be supplemented with an explicit cause by using from with raise:

raise new_exc from original_exc

The expression following from must be an exception or None. It will be set as __cause__ on the raised exception. Setting __cause__ also implicitly sets the __suppress_context__ attribute to True, so that using raise new_exc from None effectively replaces the old exception with the new one for display purposes (e.g. converting KeyError to AttributeError, while leaving the old exception available in __context__ for introspection when debugging.
'''
I am not sure how much should be copied over, but None should be at least mentioned and perhaps there should be a cross-reference.

I am also not sure how much applies to 3.2, but there is no version-added or -changed note with the above.
History
Date User Action Args
2013-02-12 01:20:00terry.reedysetrecipients: + terry.reedy, ncoghlan, docs@python
2013-02-12 01:19:59terry.reedysetmessageid: <1360631999.8.0.76627095073.issue17188@psf.upfronthosting.co.za>
2013-02-12 01:19:59terry.reedylinkissue17188 messages
2013-02-12 01:19:57terry.reedycreate