> Consider using xrange in this case.
Is xrange still a thing? doesn't range use a generator instead of creating a list nowadays?
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".