The doc says starred_expression can be used on the right side of = as shown below:
But starred_expression cannot be used on the right side of = as shown below:
v1, v2, v3 = *[0, 1, 2, 3, 4]
print(v1, v2, v3)
# SyntaxError: can't use starred expression here
Instead, starred_expression can be used on the left side of = even the doc doesn’t say starred_expression can be used on the left side of = as shown below:
v1, *v2, v3 = [0, 1, 2, 3, 4]
print(v1, v2, v3)
# 0 [1, 2, 3] 4
So, what case can starred_expression be used on the right side of =?
In addition, yield_expression can be used on the right side of = in a generator as shown below:
def func():
v = yield 'Hello'
print(v)
gen = func()
next(gen)
# 'Hello'
