One other solution is to use a `yield from` with an empty iterable, then you don't need to have an unreachable `yield`.
Le ven. 3 sept. 2021 à 09:52, Serhiy Storchaka <storch...@gmail.com> a écrit : > > 03.09.21 10:28, Thomas Grainger пише: > > the way to make an (aysnc)generator that immediately raises > > Stop(Async)Iteration immediately is to insert an unreachable `yield` > > statement, however there's two ways to do it: > > I think it is too uncommon case to specify it in PEP 8. > > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/M4TIXVDUNKPCHJUR5DNB5QLBYXC5JCWC/ > Code of Conduct: http://python.org/psf/codeofconduct/ -- Antoine Rozo _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/NDQDM6KJOCHTADZJEV3CGEMJJKKDD4ZK/ Code of Conduct: http://python.org/psf/codeofconduct/