Are you referring to data you are fetching inside a generator function? If so, are you yielding it?
If you're yielding, you can take advantage of the next method. The generator function is acting as an iterator, and you can return the next element in a sequence by invoking next() on the invoked generator (generator().next()). Since this iteration and sort of internal state that the generator maintains, you can stop at any point to see what the state is.
Thank you!
Are you referring to data you are fetching inside a generator function? If so, are you yielding it?
If you're yielding, you can take advantage of the
next
method. The generator function is acting as an iterator, and you can return the next element in a sequence by invokingnext()
on the invoked generator (generator().next()
). Since this iteration and sort of internal state that the generator maintains, you can stop at any point to see what the state is.Ah, perhaps using 'next()' was part of the puzzle I was missing. Thanks! I'm going to go and check that out.
Great! Yes, and here's a resource I found helpful on the subject by Rajesh Babu.