Author rhettinger
Recipients nikratio, rhettinger
Date 2011-12-12.02:41:23
SpamBayes Score 5.03311e-06
Marked as misclassified No
Message-id <1323657684.72.0.423067063412.issue13585@psf.upfronthosting.co.za>
In-reply-to
Content
I would like to see this posted as a recipe before being put in the standard library.  It needs a chance to mature and to demonstrate that people will want to use it.

FWIW, the example is problematic in a couple of ways.  The registration of shutil.rmtree(tmpdir) will run *before* mngr register is called.  

Also, it doesn't take advantage of any of the with-statement features.  It doesn't show any advantage over a standard try/finally which is arguably cleaner:

    tmpdir = tempfile.mkdtemp()
    try:
        # do stuff with tmpdir
    finally:
        shutil.rmtree()

Also, I suspect that the CleanupManager would be an error-prone construct because the registration occurs somewhere after the with-statement is set-up, possibly resulting in errors if there is an early, pre-registration failure.
History
Date User Action Args
2011-12-12 02:41:24rhettingersetrecipients: + rhettinger, nikratio
2011-12-12 02:41:24rhettingersetmessageid: <1323657684.72.0.423067063412.issue13585@psf.upfronthosting.co.za>
2011-12-12 02:41:24rhettingerlinkissue13585 messages
2011-12-12 02:41:23rhettingercreate