tuple syntax ',' (ending in comma?)

Michael Yanowitz m.yanowitz at kearfott.com
Tue Apr 4 09:11:26 EDT 2006


Hello:

   I am still relatively new to Python. I am confused by the syntax for
tuples.
I had:
  thread.start_new_thread(read_data_thread, (strDataFilename))
  and got back the following error:

  File "scene.py", line 256, in readData
    thread.start_new_thread(read_data_thread, (strDataFilename))
TypeError: 2nd arg must be a tuple

   The way I fixed this error was I added an extra , (comma) to the tuple:
  thread.start_new_thread(read_data_thread, (strDataFilename,))

  I am just confused by the syntax. I am used to a comma meaning that there
should be another parameter after the comma and if no additional parameter
the comma would not be necessary.

Thanks in advance:






More information about the Python-list mailing list