With the new example, you’re actually still dealing with tuples.
If you print out what the right hand side is, you’ll get
testVar = 1000, 1000,
print(testVar)
# result:
(1000,1000)
What is actually happening under the hood is that Python sees a tuple, then unpacks it into two values and assigns one to myvar
and the other to var2
. At the end of the day, the right hand side still acts as a tuple.
In fact, another way we know this to be true is if we try to unpack it but we do not provide enough variables:
myvar, = 1000, 1000,
This throws an exception:
ValueError: too many values to unpack (expected 1)
7
solved Python: What does “myvar = 1000,” do? [duplicate]