On Mon, Feb 8, 2016 at 1:51 PM, Victor Stinner <victor.stinner@gmail.com> wrote:
I didn't know. I just checked. It's assert used with a non-empty tuple:

>>> assert ("tuple",)

which is more interesting with a tuple without the parentheses:

t = In [4]: t = True,

In [5]: t

Out[5]: (True,)

works fine, but not if you use an assert:

In [7]: assert True,

  File "<ipython-input-7-38940c80755c>", line 1

    assert True,

                ^

SyntaxError: invalid syntax

I actually like the Warning with the note about the problem better:

<stdin>:1: SyntaxWarning: assertion is always true, perhaps remove parentheses?

And, of course, more relevant with something Falsey in the tuple:

In [14]: assert (False,)

<ipython-input-14-05f425f558c4>:1: SyntaxWarning: assertion is always true, perhaps remove parentheses?

  assert (False,)

But I am curious why you get a different error without the parens?

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov