Python 'list' object is not callable
pyscripter, python
Solution
Almost certainly you've rebound the name list to a list instance:
>>> import itertools
>>> print list(itertools.permutations([1,2,3,4], 2))
[(1, 2), (1, 3), (1, 4), (2, 1), (2, 3), (2, 4), (3, 1), (3, 2), (3, 4), (4, 1), (4, 2), (4, 3)]
>>>
>>> list = [2,3,4]
>>> list(itertools.permutations([1,2,3,4], 2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
Don't call lists `list`, or strings `str`, etc..
Problem
I tried running the following code in Pyscripter but it keeps returning the error "'list' object is not callable". I ran the code through the Python shell and it worked perfectly fine. I'm not quite understanding why it isn't working in Pyscripter. Also, I'm using Python 2.7. ``` import itertools print list(itertools.permutations([1,2,3,4], 2)) ``` Even creating a simple list in Pyscripter will return the same error. ``` list() ``` Thanks in advance!