Closed yusefnapora closed 8 years ago
this doesn't support concurrent iterations, does it?
Not directly, although you could call the generator
method multiple times and iterate over that. But you could only iterate over the class instance itself once
@vyzo you mean to allow multiple threads to iterate over the same object? I honestly have no idea how thread safety works in python
I'll merge this for now so I can make my tests work
no, I was talking about multiple iterations with the same object. It's fine to be iterable only once though, just pointing out the obvious :)
This changes the DatasetIterator base class to define
next
and returnself
from the__iter__
method. The main "walker" generator function is now calledgenerator
, and theLocalFileIterator
subclass now overridesgenerator
instead of__iter__
.This gets rid of the confusing
TypeError: LocalFileIterator object is not an iterator
errors by making theDatasetIterator
into an actual iterator.