Serhiy Storchaka added the comment: You can do this with a function too:
def NTF(*args, closed=False, **kwargs): if closed: kwargs["delete"] = True ntf = NamedTemporaryFile(*args, **kwargs) if closed: ntf.close() return ntf ---------- nosy: +georg.brandl, ncoghlan, serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22387> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com