I noticed by accident that Python's primitive math operators support commas in both numeric arguments. A tuple is returned. What is it doing and why is this syntax supported?
Here are a few examples:
>>> 2,10,2 / 2
(2, 10, 1)
>>> 2,10,2 * 2
(2, 10, 4)
>>> 2,10,2 % 2,3
(2, 10, 0, 3)
In
2,10,2 / 2
, the operation performed actually is:Hence you get the
(2, 10, 1)
as output.In Python, tuples are actually a collection of values separated by commas, the surrounding parentheses are to avoid ambiguity.