Last active
March 30, 2024 22:17
-
-
Save normanlmfung/d2d8dac23a3d379247cb1af76f137983 to your computer and use it in GitHub Desktop.
python_syntax_iterator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class square_all: | |
def __init__(self, numbers): | |
self.numbers = iter(numbers) | |
def __next__(self): | |
return next(self.numbers) ** 2 | |
def __iter__(self): | |
return self |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment