pyscripter - Python 'list' object is not callable -
i tried running following code in pyscripter keeps returning error "'list' object not callable". ran code through python shell , worked fine. i'm not quite understanding why 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 simple list in pyscripter return same error.
list() thanks in advance!
almost you've rebound name list 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 not callable don't call lists list, or strings str, etc..
Comments
Post a Comment