Feb-09-2021, 08:38 PM
i have a loop that is going through every file in a directory tree, doing a conversion on each, then moving that file to another directory tree. another process can add files to this directory tree at any time. so, each time this loop runs i need to get the the first file from the tree, waiting a minute if the tree is empty (until a stop flag exists in another location).
i have a generator that delivers every file in the tree when iterated.
does it make sense, that loop, to make a new generator each time and just call next() one time each instead of iterating through the directory tree?
something like:
i have a generator that delivers every file in the tree when iterated.
does it make sense, that loop, to make a new generator each time and just call next() one time each instead of iterating through the directory tree?
something like:
while True: afile=next(mygen(thetree)) ...does it make sense to "iterate" an iterator just once like that?
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.