I have a generator object that checks a certain condition on a list. This program works fine for all my cases.
But I just want to clarify some key points.
In my program Whenever the generator yield the values 'No' or 'Done' the controlling iteration stops and calls the generator with another argument.
This may be a silly question, anyway that is, whenever the generator object is yielded and we stops calling next to it, does that object is settled for garbage collecting? Or is that yielded object is being settled to garbage collecting when we call that generator again with another argument.
Please clarify this to me what happens to a generator object if we stops calling next() on it before it raise a StopIteration exception. What happens to the persevered execution points and variables of the current generator object, when we again call the generator with a new argument.