3 ms·
Not all the time. x = , causes a syntax error, while x = (,) creates an empty tuple.
by herge 12y ago
Not all the time.
x = ,
causes a syntax error, while
x = (,)
creates an empty tuple.
- dalke 12y agoUnder both Python 2.7 and Python 3.3 I get: >>> x=(,) File "<stdin>", line 1 x=(,) ^ SyntaxError: invalid syntax
- Spittie 12y agoFrom the Python docs (https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences https://docs.python.org/3/tutorial/datastructures.html#tuple...) > Empty tuples are constructed by an empty pair of parentheses; And it works fine >>> x = () >>> x () I guess Herge mean that? After all, his argument was that a tuple is not always defined by the comma.