[Python-ideas] except expression

Chris Angelico rosuav at gmail.com
Tue Feb 18 17:58:50 CET 2014


On Wed, Feb 19, 2014 at 3:56 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 18 February 2014 16:43, Chris Angelico <rosuav at gmail.com> wrote:
>>> OTOH, there's still an argument for only allowing a single exception
>>> name in the syntax (an "identifier" rather than an "expression" in
>>> syntax terms). If you must catch multiple exceptions, give the
>>> relevant tuple a name.
>>
>> Hmm. Would that make anything any clearer? It feels like the sorts of
>> crazy limitations that I've seen in some other languages, like how PHP
>> up until relatively recently wouldn't let you subscript an array
>> returned from a function without first assigning it to a variable:
>
> Maybe not. Maybe again it's just a matter of a style recommendation.
> But the PEP itself has to tread a fine line between showing what is
> *possible* vs showing what is *intended* - I feel that the intention
> of the except construct should *not* be to do most of the crazy things
> people are talking about in this thread.

That's fair. It's tricky to show that this really would be an
improvement to the language when it's showing very little, but tricky
to show that it'd be an improvement when the expressions are
horrendously obfuscated.

I expect that this would be used mostly in really really simple ways.

ChrisA


More information about the Python-ideas mailing list