Skip to content

Use itertools to make the flash cycling code more elegant #8

Description

@Joe-Heffer-Shef

https://docs.python.org/3/library/itertools.html#itertools.cycle

For example:

>>> import itertools
>>> number_of_flashes = 4
>>> flash_cycle = itertools.cycle(range(number_of_flashes))
>>> flash_cycle
<itertools.cycle object at 0x00000163FEBF2F80>
>>> next(flash_cycle)
0
>>> next(flash_cycle)
1
>>> next(flash_cycle)
2
>>> next(flash_cycle)
3
>>> next(flash_cycle)
0
>>> next(flash_cycle)
1
>>> next(flash_cycle)
2
>>> next(flash_cycle)
3
>>> next(flash_cycle)
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions