[New-bugs-announce] [issue43480] Add .path method/property to tempfile.* for a pathlib.Path

Patrick Reader report at bugs.python.org
Fri Mar 12 10:49:24 EST 2021


New submission from Patrick Reader <pxeger at protonmail.com>:

It would be nice to have a `.path` method or property on `tempfile.NamedTemporaryFile`, `tempfile.TemporaryDirectory` which produces a `pathlib.Path` of their `.name` attribute, so one can use the modern interface directly.

I think a method would be more appropriate than a property because you're explicitly allocating a new object (unless you use `@functools.cached_property` or similar to have a shared object between successive calls)

I can do a PR.

----------
components: Library (Lib)
messages: 388540
nosy: pxeger
priority: normal
severity: normal
status: open
title: Add .path method/property to tempfile.* for a pathlib.Path
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43480>
_______________________________________


More information about the New-bugs-announce mailing list