Skip to content

Commit 5bfbd49

Browse files
committed
-
1 parent ef60465 commit 5bfbd49

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

source_py3/python_toolbox/sequence_tools.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,12 @@ def flatten(iterable):
3030
3131
For example, `flatten([[1, 2], [3], [4, 'meow']]) == [1, 2, 3, 4, 'meow']`.
3232
'''
33-
33+
# If that ain't a damn clever implementation, I don't know what is.
3434
iterator = iter(iterable)
3535
try:
36-
first_item = next(iterator)
36+
return sum(iterator, next(iterator))
3737
except StopIteration:
3838
return []
39-
return sum(iterator, first_item)
4039

4140

4241
def combinations(sequence, n=None, start=0):

0 commit comments

Comments
 (0)