Guido van Rossum <gu...@python.org> added the comment:

> It makes sense to me to be able to do `(*a), b` if I can do `*a, b`, but I 
> don't really have a strong opinion on it.

I disagree. *a is not an expression, so the normal rules for parenthesizing 
those don't apply. I've always thought of *a as a feature of the "comma" 
syntax. Note too that (**a) is not valid and never was. Also note that 2.7 
doesn't support f((*a)). In fact 3.4 doesn't either -- but 3.5 does.

I don't know how this slipped into earlier Python 3 versions -- apparently 
there aren't tests for this, and it's not used in popular 3rd code either, or 
we would have found out when we first implemented PEP 617.

Most likely it's due to the general problem where the parser would just accept 
parenthesized stuff in various places where it shouldn't (e.g. also f(a=1) 
could be spelled as f((a)=1) -- this was fixed in 3.8).

> Also the current behavior allows `(*x), y = 1` assignment. If `(*x)` is to be 
> totally disallowed, `(*x), y = 1` should also be rejected.

I agree.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40631>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to