New submission from Robert Spralja <robert.spra...@gmail.com>:

`
>>> def foo(num=1):
...     return num
...
>>> foo(*(bool,) is bool else *())
  File "<stdin>", line 1
    foo(*(bool,) is bool else *())
                         ^
SyntaxError: invalid syntax
>>> foo(*(bool,) if bool else *())
  File "<stdin>", line 1
    foo(*(bool,) if bool else *())
                              ^
SyntaxError: invalid syntax
>>> def foo(num=1):
...     return num
...
>>> stri = ''
>>> foo(*(stri,) if stri else *())
  File "<stdin>", line 1
    foo(*(stri,) if stri else *())
                              ^
SyntaxError: invalid syntax
>>> foo(*((stri,) if stri else ()))
1
>>>
`

Iterable unpacking of empty tuple seems to not work in one example but does in 
another.

----------
messages: 414085
nosy: spralja
priority: normal
severity: normal
status: open
title: *() Invalid Syntax: iterable unpacking of empty tuple
versions: Python 3.9

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

Reply via email to