Saiyang Gou <[email protected]> added the comment:
Well, there is actually a bug:
root@f1b4a742d8fc:/# python3.9
Python 3.9.1 (default, Dec 8 2020, 03:24:52)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [1, 2]
>>> y = 3
>>> *x, y
(1, 2, 3)
>>> (*x), y
File "<stdin>", line 1
(*x), y
^
SyntaxError: can't use starred expression here
root@f1b4a742d8fc:/# python3.8
Python 3.8.6 (default, Oct 6 2020, 03:22:36)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = [1, 2]
>>> y = 3
>>> *x, y
(1, 2, 3)
>>> (*x), y
(1, 2, 3)
This is different from the previous message where the starred expression is
"alone" (and thus invalid). Since this bug happens in 3.9 but not in 3.8, it
might be due to the PEG parser.
Also,
root@f1b4a742d8fc:/# python3.9
Python 3.9.1 (default, Dec 8 2020, 03:24:52)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> del *x
File "<stdin>", line 1
del *x
^
SyntaxError: cannot delete starred
>>> del (*x)
File "<stdin>", line 1
del (*x)
^
SyntaxError: can't use starred expression here
The latter case should also report "SyntaxError: cannot delete starred".
----------
nosy: +gousaiyang
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40631>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com