On Sun, Oct 03, 2021 at 04:47:57PM +0100, Irit Katriel via Python-Dev wrote:
We wonder if people have a view on which of the following is clearer/better:
- except *E as e: // except *(E1, E2) as e:
That looks like you're unpacking the tuple (E1, E2), and that's just misleading and wrong.
- except* E as e: // except* (E1, E2) as e:
That looks like it is the "except" keyword which is special, not the tuple. If we're going to have yet another meaning for star (multiplication, replication, unpacking, powers, wildcard imports...) then I vote for 2.
But Thomas Grainger's comment about match semantics got me thinking. I think his suggestion is a bit too verbose, but how do people feel about borrowing the vertical line and using it like this:
except| E as e: except| (E1, E2) as e:
Again, it's attached to the except keyword, to indicate that it's the keyword which is special, not a unary prefix operator on the E.
The vertical line is suggestive of grouping something with a box around it:
+-----------------+ | group of things | +-----------------+
and of the lines used in tracebacks shown in the PEP. So the output helps remind you of the syntax.