Martin Panter added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25994>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to