Take the following example:
def test():
  return "test"
  yield "yield"
for x in test():
  print(x)
print(next(test()))
Output:
Traceback (most recent call last):
  File ".\generator.py", line 7, in <module>
    print(next(test()))
StopIteration: test
This suprised me as i expected the iterator to yield "test" and then stop on the next iteration. What is the reasoning behind this? What is it useful for?
