Author nikratio
Recipients nikratio, rhettinger
Date 2011-12-12.14:39:23
SpamBayes Score 3.07558e-05
Marked as misclassified No
Message-id <4EE61217.2040702@rath.org>
In-reply-to <1323659862.04.0.108345523123.issue13585@psf.upfronthosting.co.za>
Content
On 12/11/2011 10:17 PM, Raymond Hettinger wrote:
> 
> Raymond Hettinger <raymond.hettinger@gmail.com> added the comment:
> 
> '''
> Example code:
> 
> with CleanupManager() als mngr:
>     tmpdir = tempfile.mkdtemp()
>     mngr.register(shutil.rmtree(tmpdir)) <-- this makes the call right away
>     # do stuff with tmpdir
> '''

Oh, of course. That is fixed in the patch. I couldn't find a way to edit
the message in the tracker.

> The part of my note that should be clear is that the idea and code need to prove itself before being added to the standard library.  So far, there has been zero demand for this and I've not seen code like it being used in the wild.  AFAICT, it is not demonstrably better than a straight-forward try/finally.

I think it has the same advantages over try...finally as any use of
'with' has. CleanupManager would allow to use 'with' instead of
'try..finally' in many cases where this is currently not possible, so
unless the introduction of 'with' itself was a mistake, I think this is
just taking a step along the path that has already been chosen.

Best,

   -Nikolaus
History
Date User Action Args
2011-12-12 14:39:23nikratiosetrecipients: + nikratio, rhettinger
2011-12-12 14:39:23nikratiolinkissue13585 messages
2011-12-12 14:39:23nikratiocreate