It should work fine. Don’t use tuple, list or other special names as a variable name. It’s probably what’s causing your problem.
>>> l = [4,5,6]
>>> tuple(l)
(4, 5, 6)
>>> tuple = ‘whoops’ # Don’t do this
>>> tuple(l)
TypeError: ‘tuple’ object is not callable
Expanding on eumiro’s comment, normally tuple(l) will convert a list l into a tuple:
In [1]: l = [4,5,6]
In [2]: tuple
Out[2]:
In [3]: tuple(l)
Out[3]: (4, 5, 6)
However, if you’ve redefined tuple to be a tuple rather than the type tuple:
In [4]: tuple = tuple(l)
In [5]: tuple
Out[5]: (4, 5, 6)
then you get a TypeError since the tuple itself is not callable:
In [6]: tuple(l)
TypeError: ‘tuple’ object is not callable
You can recover the original definition for tuple by quitting and restarting your interpreter, or (thanks to @glglgl):
In [6]: del tuple
In [7]: tuple
Out[7]: