[Python-Dev] PEP 409 update [was: PEP 409 - final?]

Guido van Rossum guido at python.org
Fri Feb 3 03:39:30 CET 2012


On Thu, Feb 2, 2012 at 4:34 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Fri, Feb 3, 2012 at 10:04 AM, Guido van Rossum <guido at python.org> wrote:
>> On Thu, Feb 2, 2012 at 3:41 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>>> On Fri, Feb 3, 2012 at 9:32 AM, Yury Selivanov <yselivanov.ml at gmail.com> wrote:
>>>> In my opinion using Ellipsis is just wrong.  It is completely
>>>> non-obvious not only to a beginner, but even to an experienced
>>>> python developer.  Writing 'raise Something() from None'
>>>> looks less suspicious, but still strange.
>>>
>>> Beginners will never even see it (unless they're printing out
>>> __cause__ explicitly for some unknown reason). Experienced devs can go
>>> read language reference or PEP 409 for the rationale (that's one of
>>> the reasons we have a PEP process).
>>
>> I somehow have a feeling that Yury misread the PEP (or maybe my +1) as
>> saying that the syntax for suppressing the context would be "raise
>> <exception> from Ellipsis". That's not the case, it's "from None".
>
> Oh right, that objection makes more sense.
>
> FWIW, I expect the implementation will *allow* "raise exc from
> Ellipsis" as an odd synonym for "raise exc". I'd want to allow
> "exc.__cause__ = Ellipsis" to reset an exception with a previously set
> __cause__ back to the default state, at which point the synonym
> follows from the semantics of "raise X from Y" as syntactic sugar for
> "_exc = X; _exc.__cause__ = Y; raise _exc"

Sure. But those are all rather obscure cases. Ellipsis reads no less
or more obscure than False when written explicitly. But that doesn't
bother me.

-- 
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list