Mitar <mmi...@gmail.com> added the comment:
Why not make FileType instance also a context manager, so you could do something like: with arguments.input as f: assert arguments.input is f For backwards compatibility, FileType would open eagerly as now, but it would be closed at exit from context manager. We should just make sure we do not close stdout/stderr. ---------- nosy: +mitar _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue13824> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com