[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Wed Feb 19 08:34:28 CET 2014


On Wed, Feb 19, 2014 at 6:25 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 19 February 2014 00:10, Steven D'Aprano <steve at pearwood.info> wrote:
>> x = d1[key] except K d2[key] except K 0
>>
>>
>> which by the way looks horrible without the colons (sorry Paul, you have
>> not convinced me that the Tim Peters prohibition on grit applies here).
>
> While I did say later on yesterday that I'd become less uncomfortable
> with the except Whatever: form, I was never advocating just removing
> the colons - pick your favourite keyword-based proposal and compare
> with that if you want to see what I was talking about.
>
> But that ship has sailed, for better or worse, and it looks like the
> except-colon form is the winner. So be it.

The except-colon form is *my* currently-preferred spelling. But when
Guido took a quick look at it, he didn't like the colon form, and his
preference makes a lot more difference than mine :) It remains to be
seen whether the PEP convinces him one way or the other.

Have you a preferred keyword-based proposal? Does it use an existing
keyword or create a new one? The floor is yours, Paul: sell me your
keyword :) Bear in mind, I used to be in favour of the "expr except
Exception pass default" form, so it shouldn't be too hard to push me
back to there.

ChrisA


More information about the Python-ideas mailing list