Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Under both Python 2.7 and Python 3.3 I get:

    >>> x=(,)
      File "<stdin>", line 1
        x=(,)
           ^
    SyntaxError: invalid syntax


From the Python docs (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.


There's also the distinction between x = (3) and x = (3,)


That's a reasonable deduction. Thanks!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: