Created
July 14, 2019 15:55
-
-
Save eyaltrabelsi/ac4ce89c2d92d326bca034bcc177e6ee to your computer and use it in GitHub Desktop.
Python trick Creating an iterator that computes the function using arguments obtained from the iterable of iterables
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
>>> import itertools | |
>>> import operator | |
>>> a = [(2, 6), (8, 4), (7, 3)] | |
>>> list(itertools.starmap(operator.mul, a)) | |
[12, 32, 21] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment