Benjamin Peterson wrote:
And the primary advantage being that we don't lose an already set __cause__ (since most of the time __cause__ would be empty and we're just suppressing __context__)... seems like a good idea. +1 As far as Ellipsis goes -- I do think it works well in this case, but I am not opposed to changing it. I do think we do ourselves a disservice if we refuse to use it in other situations because "it's only for slices".2012年2月27日 Ethan Furman <[email protected]>:Benjamin Peterson wrote:2012年2月26日 Nick Coghlan <[email protected]>:Thanks for writing that up. I'd be amenable if the PEP was clearly updated to say that ``raise exc from cause`` would change from being syntactic sugar for ``_hidden = exc; _hidden.__cause__ = cause; raise exc`` (as it is now) to ``_hidden = exc; _hidden.__cause__ = cause; _hidden.__suppress_context__ = True; raise exc``. The patch should then be implemented accordingly (including appropriate updates to the language reference).I add the following lines to the PEP: To summarize, ``raise exc from cause`` will be equivalent to:: exc.__cause__ = cause exc.__suppress_context__ = cause is None raise excSo exc.__cause__ will be None both before and after `raise Exception from None`?Yes.
~Ethan~ _______________________________________________ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com