5 ms·
The iter* methods appear in Python 3, just without the iter prefix. Therefore it is good to use them in Python 2 because that makes it possible to translate the
by andreasvc 14y ago
The iter* methods appear in Python 3, just without the iter prefix. Therefore it is good to use them in Python 2 because that makes it possible to translate the code automatically with the 2to3 script. Otherwise possibly superfluous list conversion might get added, e.g., list(d.keys()).
- DasIch 14y ago.keys(), .views() and .items() in Python3 return a memoryview which happen to be iterators but do far more.