Skip to content

Commit

Permalink
chore(list)!: change default value in flatten()
Browse files Browse the repository at this point in the history
  • Loading branch information
breakthewall committed Dec 7, 2023
1 parent 838d5ac commit 984d706
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion brs_utils/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def diff(first, second):


def flatten(
items: List=[]
items: List=None
) -> Generator:
'''Flatten a list.
Expand All @@ -96,6 +96,8 @@ def flatten(
:return: Atomic values
:rtype: Generator
'''
if items is None:
items = []
# https://stackoverflow.com/questions/952914/how-to-make-a-flat-list-out-of-a-list-of-lists
for x in items:
if isinstance(x, Iterable) and not isinstance(x, (str, bytes)):
Expand Down

0 comments on commit 984d706

Please sign in to comment.