-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Hi,
The function cumsum uses the deprecated .next() method. In Python 3.10, it's recommended to use the built-in next() function instead like s = next(iterable). Do you agree?
def cumsum(iterable):
""" Cumulative addition: list(cumsum(range(4))) => [0, 1, 3, 6]
Return a list of numbers
"""
iterable = iter(iterable)
s = iterable.next()
yield s
for c in iterable:
s = s + c
yield s
Metadata
Metadata
Assignees
Labels
No labels