SLinkedList object is not callable

112 views Asked by At

I was curious why this piece of code runs well in a terminal but in spyder, it throws the error TypeError: 'SLinkedList' object is not callable.

from itertools import combinations
l1 = [1,2,3,4]
result = []
for i in range(len(l1)+1):
        c = combinations(l1, i)
        for j in c:
                #type(j) is <class 'tuple'>
                result.append(list(j)) #error on doing list(j)

print(result)

Thanks in advance.

1

There are 1 answers

1
VJAYSLN On BEST ANSWER

check whether you are overwriting "list" object somewhere else in your full source code.

>>> list = [1,2,3,4]
>>> tup = (1,2,3)
>>> print(list(tup))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not callable
>>>