This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients benhoyt, gvanrossum, martin.panter, serhiy.storchaka, vstinner
Date 2016-01-14.22:14:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452809656.09.0.116484964328.issue25994@psf.upfronthosting.co.za>
In-reply-to
Content
I definitely support adding a close() method, and a ResourceWarning if the iterator is not exhausted when it is deallocated. Adding context manager support is probably worthwhile as well, though there is one disadvantage: it would be hard to implement scandir() as a plain generator, because generators don’t support the context manager protocol. But C Python’s implementation is in C, and even in native Python you could implement it as a custom iterator class.

I suggest using this issue for adding the new API(s), presumably to 3.6 only, and Issue 26111 for adding a warning to the existing 3.5 documentation.
History
Date User Action Args
2016-01-14 22:14:16martin.pantersetrecipients: + martin.panter, gvanrossum, vstinner, benhoyt, serhiy.storchaka
2016-01-14 22:14:16martin.pantersetmessageid: <1452809656.09.0.116484964328.issue25994@psf.upfronthosting.co.za>
2016-01-14 22:14:16martin.panterlinkissue25994 messages
2016-01-14 22:14:15martin.pantercreate