In comparing documentation for itertools between Python 2 and 3, I noticed ifilter
, imap
, izip
are missing from Python 3. I suspect this is because many builtin keywords have been converted to generators and replaced former keywords, but it is unclear in this case.
Is it true ifilter
, imap
, izip
are now equivalent to filter
, map
, zip
in Python 3? If not, where can I find rationales for why certain methods were removed from current itertools
?
Python 2.3 introduced the itertools
module, which defined variants of the global zip()
, map()
, and filter()
functions that returned iterators instead of lists. In Python 3, those global functions return iterators, so those functions in the itertools module have been eliminated.
itertools.izip()
, just use the global zip()
function.itertools.imap()
, just use map()
.itertools.ifilter()
becomes filter()
.Read more here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With