Nick Coghlan <ncogh...@gmail.com> added the comment:

Merging the interfaces for mkdtemp and TemporaryDirectory isn't going to happen.

mkstemp/mkdtemp are for when the user wants to control the lifecycle of the 
filesystem entries themselves. (Note that context management on a regular 
file-like object only closes the file, it doesn't delete it from the 
filesystem). They're also intended as relatively thin wrappers around the 
corresponding C standard library functionality.

The other objects in tempfile (TemporaryFile, TemporaryDirectory, etc) are for 
when the user wants the lifecycle of the Python object to correspond with the 
lifecycle of the underlying filesystem element.

That said, TD itself can be used to create the temporary directory without 
having to use it as a context manager (the underlying directory is created in 
__init__, not __enter__).

----------

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

Reply via email to