Skip to content

sum_it uninteresting #2

@apalala

Description

@apalala

In koans/about_generators.py, the function sum_it is uninteresting. It would be much better if it was:

def sum_it(self, seq):
    value = 0
    for num in seq:
        # The local state of 'value' will be retained between iterations
        value += num
        yield value # the yield is now inside the for

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions