python TypeError:'list'对象不可调用错误

rus*_*121 0 python

我是python的新手,我试图在这里理解一个基本的错误.我得到一个TypeError:'list'对象在下面的代码中不是可调用的错误.有人可以解释一下我的代码中有什么问题吗?

graph = {'a': ['b', 'c'], 'b': ['a', 'c'], 'c': ['b', 'd'], 'd': ['a'], 'e': ['a']}


def reachable(graph, node):
    res = [node]
    reachable = graph[node]
    for currentnode in reachable:
        if currentnode not in res :
            reachableNodes = reachable(graph,currentnode) << TypeError: 
            for newNode in reachableNodes:
                if newNode not in res :
                    res.append(newNode)
    return res 
Run Code Online (Sandbox Code Playgroud)

错误:TypeError:'list'对象不可调用错误

Dan*_*man 7

你已经隐藏了函数名reachable = graph[node].使用其他名称.