Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info>: > (To be honest, I'm not even sure what the use-case for close() on > coroutines is in the first place. If you don't want to send any more > items into it, just don't send any more items into it.)
Without close(), you might leave resources hanging. See PEP 325: Rejected in favor of PEP 342 which includes substantially all of the requested behavior in a more refined form. And PEP 342: Raymond Hettinger (PEP 288) and Samuele Pedroni (PEP 325) first formally proposed the ideas of communicating values or exceptions into generators, and the ability to "close" generators. One *might* take the stance that resource allocation is outside the scope of iterators, generator iterators and coroutine generator iterators. As it stands, it is unclear if the application *must* call close() on generator iterators that are left hanging. Marko -- https://mail.python.org/mailman/listinfo/python-list