New submission from Pat Gunn <pgun...@gmail.com>:

Right now, when tempfile.TemporaryDirectory() is used as a context manager, the 
context variable is stringy, usable as a string containing the directory name 
it made. When used directly, it returns an object that does not coerce to a 
nice string, instead requiring the .name method to be called.

I propose adding a __str__() to the class that causes it to serialise nicely 
into a string containing just the directory name, so the (in my view 
surprising) differences in behaviour are minimised.

----------
components: Library (Lib)
messages: 353327
nosy: Pat Gunn
priority: normal
severity: normal
status: open
title: tempfile.TemporaryDirectory() should behave the same as a context 
manager as when used directly
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

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

Reply via email to