multiple assignments with a comma in python -
i tried find explanation of this, gotcha part:
b = "1984" = b, c = "ab" print(a, b, c) returns:
('ab', 'a', 'b') i understand happens multiple equals:
a = b = 1 but using comma, cannot understand behaviour, ideas in why works way?
the answer
a = b, c ="ab" acts like:
a = (b, c) = "ab" this why:
a = "ab" , b = "a" , c = "b"
Comments
Post a Comment