Author Nils Kattenbeck
Recipients Anthony Sottile, CAM-Gerlach, Nils Kattenbeck, epicfaace, georg.brandl, maurosr, ncoghlan, nyuszika7h, pitrou, r.david.murray, serhiy.storchaka
Date 2021-05-26.21:08:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:
        def normal_mkdtemp():
            yield tempfile.mkdtemp()
        return normal_mkdtemp(*args, **kwargs)
        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:52Nils Kattenbecksetrecipients: + Nils Kattenbeck, georg.brandl, ncoghlan, pitrou, r.david.murray, serhiy.storchaka, maurosr, Anthony Sottile, epicfaace, CAM-Gerlach, nyuszika7h
2021-05-26 21:08:52Nils Kattenbecksetmessageid: <>
2021-05-26 21:08:52Nils Kattenbecklinkissue25024 messages
2021-05-26 21:08:52Nils Kattenbeckcreate