On Tue, Oct 05, 2021 at 11:17:25AM -0400, Calvin Spealman wrote:
On Tue, Oct 5, 2021 at 10:51 AM Patrick Reader <_@pxeger.com> wrote:
On 03/10/2021 16:47, Irit Katriel via Python-Dev wrote:
1. except *E as e: // except *(E1, E2) as e: 2. except* E as e: // except* (E1, E2) as e:
I vote #2, because `except *(e1, e2) as e:` could imply that this is splatting an arbitrary expression there - it looks like it will match any number of dynamically chosen exception types.
But it only looks like splatting because you changed it from `(E1, E2)` to `(e1, e2)` where Title Case names will look like a matched type and lower case names will look like destination names. So, given these will be class names and 99.9% Title Case, Option 1 does not really fail under your suggested confusion here.
It's the asterisk `*`, not the case of the names, that makes it look like sequence unpacking. Sequence unpacking works on sequences of types or other names that start with capital letters. There is no difference between unpacking a tuple of classes with a capital letter and a tuple of classes with names that start with lower case letters: a, b, c = *(ValueError, TypeError, Exception) a, b, c = *(int, float, str) Shockingly, we can even use mixed case and unusual naming conventions! obj, Module = (None, sys) *wink*