I'm reading about *args
and **kwargs
in Python, and am experimenting in the REPL:
varX, *varY = [99, 100, 101]
I was expecting varX
to be [99, 100, 101]
, but that's not what happened. Instead I get this:
print(varX)
# 99
Huh? Well then what is varY
?
print(varY)
# [100, 101]
Getting the list makes sense, but I thought it would have three values, and not two.
print(*varY)
# 100 101
At least this makes sense to me based on all of the stuff that's happened before. So my big question is why is Python (3.6) making the original assignments in this manner?