Since the tuple syntax inside the function call is also a way to pass parameters:
>>> print type(1,2) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: type() takes 1 or 3 arguments >>> print type((1,)) <type 'tuple'> >>> a = 1, >>> type(a) <type 'tuple'>
This is the syntax ambiguity for python that it solves by deciding that you are trying to pass a parameter (if you ask me, it should be a syntax error, though).
>>> print type(1,) >>> print type(1)
Same.
source share