Message394462
While the proposal linked by C.A.M. solves one of the use cases but it does not address the others.
One use cases which is rather common for me it is e.g. to have scripts/programs which allow configuring whether temporary directories should get deleted or stay persistent after program exit.
Currently this always requires hand rolled wrappers like the following:
def mkdtemp_persistent(*args, persistent=True, **kwargs):
if persistent:
@contextmanager
def normal_mkdtemp():
yield tempfile.mkdtemp()
return normal_mkdtemp(*args, **kwargs)
else:
return tempfile.TemporaryDirectory(*args, **kwargs)
with mkdtemp_persistent(persistent=False) as dir:
...
Which gets the job done but is not as user friendly as other parts of the stdlib. |
|
Date |
User |
Action |
Args |
2021-05-26 21:08:52 | Nils Kattenbeck | set | recipients:
+ Nils Kattenbeck, georg.brandl, ncoghlan, pitrou, r.david.murray, serhiy.storchaka, maurosr, Anthony Sottile, epicfaace, CAM-Gerlach, alexia |
2021-05-26 21:08:52 | Nils Kattenbeck | set | messageid: <1622063332.6.0.528635620878.issue25024@roundup.psfhosted.org> |
2021-05-26 21:08:52 | Nils Kattenbeck | link | issue25024 messages |
2021-05-26 21:08:52 | Nils Kattenbeck | create | |
|