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:
> 
> 1. 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.

> 2. 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.



-- 
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EA7E3EGQ6WB5O3ITPTN53C4CMFHDLBFK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to