0

Python assignment statement with extra comma at end creates a tuple (not syntax error):

>>> tuple_int = 3 ,
>>> tuple_int
(3,)
>>> another_one = 4,
>>> another_one
(4,)
>>>

Why?

Caused a hard-to-find bug for me.

The python syntax does not seem to allow this: https://docs.python.org/3/reference/simple_stmts.html

I'm using python 3.4.1 on windows.

TaiwanGrapefruitTea
  • 1,045
  • 2
  • 14
  • 25

0 Answers0