[Tutor] range as a not-quite-iterator

eryksun eryksun at gmail.com
Sun Aug 4 04:25:29 CEST 2013


On Sat, Aug 3, 2013 at 9:32 PM, eryksun <eryksun at gmail.com> wrote:
> The range object itself doesn't have to keep track of the state of
> each iteration. It just spins off an iterator that handles it. Like
> most iterators these get used once and thrown away:

A common exception to this is the file type. A file is an iterator
that can be rewound and reused (e.g. seek(0)). If you want concurrent
access to a file, each with its own file pointer, then you have to
open the file multiple times -- for the obvious reason that the
operating system manages the underlying data structure.


More information about the Tutor mailing list