Comma before the equals


Please can you explain why we can put the comma infront of the equal sign.
What is the general rule for this in Python.

welcome to the forums.

I was going to say that it’s comma separated variable assignment, but it’s called “tuple assignment”.
a, b = 0, 1

where a = 0
and b = 1

Actually, I guess it should be in parentheses:
(a, b) = (0, 1)

This means the function returns multiple variables, that happens in the form of a tuple. Using multiple variables separated by a comma unpacks the tuple return into the variables.