3 ms·
Those things return generators now to avoid wasting memory (you don't need to create possibly humongous list and keep it in memory during the iteration). If you
by bluecalm 13y ago
Those things return generators now to avoid wasting memory (you don't need to create possibly humongous list and keep it in memory during the iteration). If you want a list, just do list(your expression). If you forgot about it then do: list(_) as the very next thing. Like this:
>>> map(lambda x: x*x, range(1,10))
<map object at 0x02DDDB90>
>>> list(_)
[1, 4, 9, 16, 25, 36, 49, 64, 81]
Wtp ?
- tsuraan 13y agoYeah, it's definitely something that can be worked around, but it's something I don't have to get around in python2, so I keep using python2. Nothing truly major, just a sticky point.