[Python-ideas] except expression

Paul Moore p.f.moore at gmail.com
Tue Feb 18 17:56:41 CET 2014


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.

Paul


More information about the Python-ideas mailing list