Avoid mutable default arguments (#4691)

This commit is contained in:
Christian Clauss
2021-08-31 06:56:15 +02:00
committed by GitHub
parent 3acca3d1d1
commit 097f830238
3 changed files with 7 additions and 7 deletions

View File

@ -168,11 +168,11 @@ def construct_graph(cluster, nodes):
return graph
def myDFS(graph, start, end, path=[]):
def myDFS(graph, start, end, path=None):
"""
find different DFS walk from given node to Header node
"""
path = path + [start]
path = (path or []) + [start]
if start == end:
paths.append(path)
for node in graph[start]: