Avoid mutable default arguments (#4691) · zinating/algorithms-python@097f830 · GitHub
Skip to content

Commit 097f830

Browse files
authored
Avoid mutable default arguments (TheAlgorithms#4691)
1 parent 3acca3d commit 097f830

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

graphs/eulerian_path_and_circuit_for_undirected_graph.py

Lines changed: 2 additions & 2 deletions

graphs/frequent_pattern_graph_miner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ def construct_graph(cluster, nodes):
168168
return graph
169169

170170

171-
def myDFS(graph, start, end, path=[]):
171+
def myDFS(graph, start, end, path=None):
172172
"""
173173
find different DFS walk from given node to Header node
174174
"""
175-
path = path + [start]
175+
path = (path or []) + [start]
176176
if start == end:
177177
paths.append(path)
178178
for node in graph[start]:

maths/radix2_fft.py

Lines changed: 3 additions & 3 deletions

0 commit comments

Comments
 (0)