Serhiy Storchaka added the comment: If scandir() is implemented as native Python generator (see for example issue25911), it could easily be converted to context manager:
def scandir(path): return contextlib.closing(native_scandir(path)) def native_scandir(path): ... yield ... ---------- _______________________________________ 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