Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Created June 25, 2023 08:36
Show Gist options
  • Save stephengruppetta/bea91c185a2e3e979e531b91a8ea2612 to your computer and use it in GitHub Desktop.
Save stephengruppetta/bea91c185a2e3e979e531b91a8ea2612 to your computer and use it in GitHub Desktop.
class RandomWalk:
def __init__(self, iterable):
self.values = list(iterable)
def __iter__(self):
# There's nothing in this method just yet
...
captains = RandomWalk(
[
"Pike",
"Kirk",
"Picard",
"Sisko",
"Janeway",
"Riker",
]
)
for captain in captains:
print(captain)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment