From: Michael Hudson Date: Wed Nov 26, 2003 11:43:52 Europe/London To: Bill Soudan Subject: Re: PEP 310/object lifetimes? Is this the same Bill Soudan as in libicq? That stirs some old memories... Bill Soudan writes: > Hi Michael, > > You mention in PEP-310: > > If a way of controlling object lifetimes explicitly was > available, the function of the __exit__ hook could be taken over > by the existing __del__ hook. Unfortunately, no workable > proposal for controlling object lifetimes has been made so far. Actually, I think that must have been Paul. At least I don't remember writing it. > I've recently been wishing for the ability to control an object's > lifetime in Python. I also think it would be a more elegant > solution than the __enter__ and __exit__ hooks, for instance, no > need to retro-fit existing classes. I think it's a *different* solution to a different problem. While the "Resource Acquistion is Initialization" pattern works pretty well in C++, I'm not sure it would work so well in Python. Maybe it's just my distrust of __del__ methods. > I did a bit of digging, but I couldn't come up with much. Has it > been discussed before, and if so, do you remember where? And does > your comment mean it isn't possible given the current > implementation? Maybe you should ask Paul? I haven't done a lot of thinking about this. Cheers, mwh -- I have a cat, so I know that when she digs her very sharp claws into my chest or stomach it's really a sign of affection, but I don't see any reason for programming languages to show affection with pain. -- Erik Naggum, comp.lang.lisp