Created
March 1, 2020 19:55
-
-
Save marc-queiroz/2910814d930c9b4e03c08a07f05710e7 to your computer and use it in GitHub Desktop.
Python generator
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
| funcs = [lambda x: x*x, lambda x: x+x] | |
| arr = [1,2,3,4] | |
| def generator(): | |
| for func in funcs: | |
| yield func | |
| for index, func in enumerate([[y for y in generator()] for x in generator()]): | |
| arr = map(func[index], arr) | |
| print('<generator object {}>'.format(list(arr))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment