I was looking at some code that returns the second largest element of a list and came across a weird use of commas. Hopefully someone can explain it to me:
it is the
m1, m2 = x, m1
part of the following code:
def second_largest(numbers):
m1, m2 = None, None
for x in numbers:
if x >= m1:
m1, m2 = x, m1
elif x > m2:
m2 = x
return m2
What is getting assigned what in this if statement?