This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients nikratio, rhettinger
Date 2011-12-12.02:41:23
SpamBayes Score 5.03311e-06
Marked as misclassified No
Message-id <>
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()
        # do stuff with tmpdir

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.
Date User Action Args
2011-12-12 02:41:24rhettingersetrecipients: + rhettinger, nikratio
2011-12-12 02:41:24rhettingersetmessageid: <>
2011-12-12 02:41:24rhettingerlinkissue13585 messages
2011-12-12 02:41:23rhettingercreate