4 ms·
> Consider using xrange in this case. Is xrange still a thing? doesn't range use a generator instead of creating a list nowadays?
by u124556 12y ago
> Consider using xrange in this case.
Is xrange still a thing? doesn't range use a generator instead of creating a list nowadays?
- omaranto 12y agoWell, I'd say no, not in "Python". It seems to me that when people say "Python" they still mostly mean Python 2, where range returns a list and xrange a generator. In Python 3 there is no xrange and range returns a generator, but I think people still most often call that language "Python 3", not "Python".
- minopret 12y agoYes, I'd revise as "Consider using Python 3 in this case." This is a chief reason why I now avoid Python 2. Python 3 is more than five years old. Where we have discretion to choose Python 3, it's time to exercise that discretion. Not because 3 is greater than 2. Because Python 2 has prominent pains that are healed in Python 3.