I create a list as:
>>> seq = [1, 2, 3, 4]
Now I will assign the variables as follows:
>>> a, b, c, d, *e = seq
>>> print(a, b, c, d, e)
I get output like:
>>> 1 2 3 4 []
Now I am changing the sequence in which I assign the variables as:
>>> a, b, *e, c, d = seq
>>> print(a, b, c, d, e)
I get output like:
>>> 1, 2, 3, 4, []
So my question is: why is the * e variable always assigned an empty list no matter where it appears?
source
share