New submission from Wietse Jacobs <[email protected]>:
I suspect that I found a bug. If I run the following script:
```
def f(t=None):
t0, t1 = t if t is not None else [], []
return t0, t1
def g(t=None):
if t is None:
t = [], []
t0, t1 = t
return t0, t1
def test():
res_f = f(t=([1, 1], [2, 2]))
res_g = g(t=([1, 1], [2, 2]))
assert res_f == res_g, f'{res_f=} != {res_g=}'
test()
```
I get an assertion error, with:
```
res_f=(([1, 1], [2, 2]), []) != res_g=([1, 1], [2, 2])
```
I expected them to be equal.
----------
messages: 385607
nosy: wietse.j
priority: normal
severity: normal
status: open
title: Unpacking tuple argument in combination with inline if statement
type: behavior
versions: Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43021>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com