As documented, in the migration guide,
In Python 2 map() returns a list while in Python 3 it returns an iterator.
Python 2:
Apply function to every item of iterable and return a list of the results.
Python 3:
Return an iterator that applies function to every item of iterable, yielding the results.
Python 2 always does the equivalent of list(imap(...))
, Python 3 allows for lazy evaluation.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…