Message414085
`
>>> 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. |
|
Date |
User |
Action |
Args |
2022-02-26 09:04:32 | spralja | set | recipients:
+ spralja |
2022-02-26 09:04:32 | spralja | set | messageid: <1645866272.11.0.779642676261.issue46865@roundup.psfhosted.org> |
2022-02-26 09:04:32 | spralja | link | issue46865 messages |
2022-02-26 09:04:32 | spralja | create | |
|