Tim Golden <m...@timgolden.me.uk> added the comment: On 30/06/2012 06:45, Daniel Lenski wrote: > My preferred solution would be to replace the binary delete argument of the > current NamedTemporaryFile implementation with finer-grained options: > delete=False # don't delete > delete=True # delete after file closed, current behavior > delete=AFTER_CLOSE # delete after file closed > delete=AFTER_CM_EXIT # delete after context manager exits > delete=AFTER_CM_EXIT_NO_EXCEPTION # delete after CM exit, unless this is > due to an exception
I'm aware that Richard & others are fleshing out alternatives. But my having asked you to propose something I wanted to come back on this particular suggestion. I think it's just too complex an API. Not least because, on Windows, we're making use of a filesystem feature which will delete on closure regardless (so the implementation on Windows skips the context-based delete). I'm not sure what we'll end up with but I'm more inclined towards the sort of method-based closer/reopener which is more explicit. ---------- title: tempfile.NamedTemporaryFile not particularly useful on Windows -> tempfile.NamedTemporaryFile not particularly useful on Windows _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14243> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com