News for hackers. Stuff that matters.
Re:What’s New in Python 3.8 by ciupicri on Tuesday October 15, 2019 @10:03AM (#21258420)
Instead of raising StopIteration you could also just return from the function. You could also make it a bit shorter if you swap the if branches.

  def f_iter(many, args):
      while True:
          m = f(many, args)
          if not m:
              return
          yield m
Re:What’s New in Python 3.8 by zb on Tuesday October 15, 2019 @10:12AM (#21258523)
Instead of raising StopIteration you have to return from the function, otherwise you'll just get a RuntimeError starting with Python 3.7.
Re:What’s New in Python 3.8 by ciupicri on Tuesday October 15, 2019 @11:20AM (#21259375)
You're right. The [changelog] for Python 3.7 states:

> [bpo-32670]: Enforce [PEP 479] for all code. This means that manually raising a StopIteration exception from a generator is prohibited for all code, regardless of whether ‘from __future__ import generator_stop’ was used or not.

[changelog]: https://docs.python.org/3.7/whatsnew/changelog.html#id115

[bpo-32670]: https://bugs.python.org/issue32670

[PEP 479]: https://www.python.org/dev/peps/pep-0479/