# Notations for dealing with generators in algorithms

This question is about generators, which are functions that return an item from a (usually very large or infinite) set on demand, an example from Python is:

def all_natural_evens():
n = 0

while True:
yield n
n += 2


As can be seen, the above function yields the even number n in an infinite loop, in other words, it yields all positive even numbers, but since they are infinite and computer memory is finite, they generate the numbers one by one, on demand (using next(gen) to get the next number of the generator gen, where gen = all_natural_evens()).

I am using generators to build an algorithm and when writing it in Latex, I didn't know how to express this in the algorithm, for ordinary return values there is return, but with generators in Python there is yield and yield from (yield from works like an intermediary generator, it generates from a generator...clearly). Is there any notation anywhere for dealing with this kind of generators?

At the moment I'm using keywords $$\text{yield}$$ and $$\text{yield from}$$ in the algorithm's pseudocode and explaining what they do.