Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MapObject:
- def __init__(self, function, *iterables):
- self.function = function
- self.iterables = iterables
- def __iter__(self):
- for args in zip(*self.iterables):
- yield self.function(*args)
- obj = MapObject(print, [1,2], ['a','b'])
- obj2 = map(print, [1,2], ['a','b'])
- for _ in obj:
- pass
- for _ in obj2:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement