On 2023-03-02, Stephen Tucker <stephen_tuc...@sil.org> wrote: > The range function in Python 2.7 (and yes, I know that it is now > superseded), provokes a Memory Error when asked to deiliver a very long > list of values. > > I assume that this is because the function produces a list which it then > iterates through. > > 1. Does the range function in Python 3.x behave the same way?
No, in Python 3 it is an iterator which produces the next number in the sequence each time. > 2. Is there any equivalent way that behaves more like a for loop (that is, > without producing a list)? Yes, 'xrange' in Python 2 behaves like 'range' in Python 3. -- https://mail.python.org/mailman/listinfo/python-list