[New-bugs-announce] [issue30084] about starred expression

umedoblock report at bugs.python.org
Sun Apr 16 18:39:03 EDT 2017


New submission from umedoblock:

Hi, all.

First of all, my python environment is below.

Python 3.5.2+ (default, Sep 22 2016, 12:18:14) 
[GCC 6.2.0 20160927] on linux

= differ evaluation order about starred expression
I get below result then I run x.py
======================================================
  File "/home/umedoblock/x.py", line 4
    (*(1, 2))
    ^
SyntaxError: can't use starred expression here
======================================================

Next, I comment out line 4 and run Python3.
I got below result.
And I feel strange behavior above result.
Because I think that Python should return same result above and below. 
======================================================
Traceback (most recent call last):
  File "/home/umedoblock/x.py", line 1, in <module>
    list(*(1, 2))
TypeError: list() takes at most 1 argument (2 given)
======================================================

= pass or not about starred expression.
list expression pass starred expression, the other hand
tuple expression cannot pass starred expression.
I hope to pass starred expression about list and tuple.
>>> [*(1, 2)]
[1, 2]
>>> (*(1, 2))
  File "<stdin>", line 1
SyntaxError: can't use starred expression here

----------
components: Regular Expressions
files: x.py
messages: 291769
nosy: ezio.melotti, mrabarnett, umedoblock
priority: normal
severity: normal
status: open
title: about starred expression
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file46807/x.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30084>
_______________________________________


More information about the New-bugs-announce mailing list