[issue43021] Unpacking tuple argument in combination with inline if statement

2021-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a operation precedence issue. The line: t0, t1 = t if t is not None else [], [] is parsed as: (t if t is not None else []), [] so you need brackets around the "else" operand to get the effect you want. t0, t1 = t if t is not None els

[issue43021] Unpacking tuple argument in combination with inline if statement

2021-01-25 Thread Wietse Jacobs
New submission from Wietse Jacobs : 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=