Created
June 10, 2021 01:57
-
-
Save rajmayank/f2af6d0994589f0e646960074c194e95 to your computer and use it in GitHub Desktop.
Python-Generators-Anitopatterns
This file contains 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
theGlobalMultiplier = 5 | |
def myMultiplyingGenerator(numbers): | |
for number in numbers: | |
yield number * theGlobalMultiplier | |
for multipliedNumber in myMultiplyingGenerator(range(1,10)): | |
if multipliedNumber > 25: | |
theGlobalMultiplier = 10 | |
print(multipliedNumber) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment