3 ms·
I like the Zen of Python myself, but the first thought that crossed my mind was that the Python example could use xrange and save the generation of a temporary
by JoelPM 17y ago
I like the Zen of Python myself, but the first thought that crossed my mind was that the Python example could use xrange and save the generation of a temporary list. So there are at least two ways of doing it in Python, both of which look very similar and differ only in the underlying implementation.
This makes me curious how much more frequently range is used than xrange and in what situations it's preferable.
- pwang 17y agoThis is an acknowledge minor "wart". In Python 3.0, range() does the same thing as xrange().