Skip to content

Commit 95c10f6

Browse files
authored
Merge pull request keon#3 from cclauss/patch-1
Deal with garbage in a, Deal with tuples
2 parents d0a0ce6 + 1a53f6f commit 95c10f6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

array/flatten.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@
1515

1616

1717
def list_flatten(l, a=None):
18-
# check a
19-
if a is None:
20-
# initialize with empty list
21-
a = []
22-
18+
a = list(a) if isinstance(a, (list, tuple)) else []
2319
for i in l:
24-
if isinstance(i, list):
20+
if isinstance(i, (list, tuple)):
2521
list_flatten(i, a)
2622
else:
2723
a.append(i)

0 commit comments

Comments
 (0)