Here, load_items() is a generator that will iterate over a sequence
like [True, True, ..., True, False]. The next() method is used to
get the next value from the iterator. When used as an idle function
with this particular generator, it results in one item being added to
the list store per idle call til we get to the end of the generator
body where the "yield False" statement results in the idle
function being removed.
For a lot of algorithms, this removes the need to design and debug a
state machine equivalent. Of course, it is
to do similar things in C but that's even more obscure :).
I use that thechnique too, but if the obj.get_* functions in your
example are not too expensive, the call overhead really slows things
down. this can be fixed again by adding like 10 items or so in one go.
replace "yield True" with something like:
i += 1
if not i % 10:
and feel the difference.