In Python 3.5, the code
>>> T = map(print, [1, 2, 3])
>>> type(T)
<class 'map'>
returns a map object. I would expect this map object T to contain the numbers 1, 2 and 3; all on separate lines.
In actuality, this does happen. The only problem is that it also outputs a list of None
values the same length as the input list.
>>> list(T)
1
2
3
[None, None, None]
>>>
This is repeatable for any input I use, not just the arbitrary integer list shown above. Can anyone explain why this happens?