Lazy Built-ins
In Python 3, zip(), map(), and filter() all return lazy iterators, not lists. Wrap in list() to materialize.
In Python 3, zip(), map(), and filter() all return lazy iterators, not lists. Wrap in list() to materialize.
nums = [1, 2, 3, 4, 5]
doubled = map(lambda x: x * 2, nums) # lazy iterator
print(type(doubled)) # <class "map">
print(list(doubled)) # [2, 4, 6, 8, 10]
map/filter return iterators in Python 3; in Python 2 they returned lists.