Yield in python similar to the return key word, but instead of returning the output it returns a generated that can be iterated over. When you use the yield key word it will also remember the state of local variables for the next execution.
You can read more about generators in the python reference docs.