After getting used to writing async functions, I’ve been wanting use a similar syntax to declare generator functions. Something along the lines of
`iter def my_iterator() -> T` and/or `gen def my_generator() -> (T, U, V)` Obviously, for backwards compatibility, this would need to be optional or have an opt-in mechanism. Would a feature like this be at all within the realm of possibility? I’d be happy to write up a much longer discussion if so. (I found a short discussion of such a feature in the archives about 8 years ago[1]. But, since it predates both `async def` and the current type checker regime, I thought it might be worth discussing. Apologies if I missed any more recent discussions.) Thanks, Aaron [1] https://mail.python.org/archives/list/python-ideas@python.org/thread/OVIHVRKFUN4KMDTVSIAAN2CGR7VXFGQS/#GE6RDNWTR4PPKSMKSGMCFBFUJ42FWWV6 _______________________________________________ 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/YGFRUHDAOXPHUKODV5VOPQZGJFLRBWLT/ Code of Conduct: http://python.org/psf/codeofconduct/