[Python-Dev] With statement

Neal Norwitz neal@metaslash.com
Tue, 04 Feb 2003 12:51:39 -0500


On Tue, Feb 04, 2003 at 05:19:39PM -0000, Duncan Booth wrote:
> On 4 Feb 2003 at 17:02, Moore, Paul wrote:
> > # You do realise you can't use a raw file object here really? 
> 
> Unless of course the file object sprouted an __exit__ method.
> It's probably worth including the pro's and con's of that in 
> your PEP.
> 
> I can see people falling into the trap of expecting the file 
> object to 'do the obvious thing' here (Neal Norwitz being the 
> first, but almost certainly not the last).

I was actually assuming that ultimately we'd just add a few methods to
objects (like file & Lock).  I see no benefit to add new builtins for
autoclosefile and synchronized.  It seems easier and more
straightforward to add the special methods to the objects.

Neal