Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22042

Re: Best way to disconnect from ldap?

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Best way to disconnect from ldap?
Date 2012-03-22 15:27 -0400
References (2 earlier) <CALvWhxvq-KO0ZxMwo-A7ieLyULHh95LAAiLon3zqBgMixZpFbA@mail.gmail.com> <4F6A4D02.6020403@tim.thechases.com> <mailman.885.1332422068.3037.python-list@python.org> <4f6b60b2$0$29981$c3e8da3$5496439d@news.astraweb.com> <4F6B6755.7000104@tim.thechases.com>
Newsgroups comp.lang.python
Message-ID <mailman.900.1332444484.3037.python-list@python.org> (permalink)

Show all headers | View raw


On 3/22/2012 1:54 PM, Tim Chase wrote:
> On 03/22/12 12:26, Steven D'Aprano wrote:
>> On Thu, 22 Mar 2012 08:14:47 -0500, Tycho Andersen wrote:
>>> Given that you can't trust __del__, is there a legitimate
>>> use case for it?

It is part of original or early Python and pretty well superceded by 
cyclic gc (which does not work for object with __del__ *because* of the 
unreliability), explicit close methods, and now context managers.
>>
>> I've never found the need to write one.
>
> I've found the need to write them...then been frustrated by things
> falling out of namespace reach, and found that context managers do a
> much more reliable/understandable job, saving what little sanity I had
> left. ;-)

Which is one reason they were added ;-).

> So I'd say that __del__ was really only useful (for some sick, sick
> definition of "useful") in versions of Python before context-managers
> were readily available.

And before cyclic gc, which does a better job of ordering deletions.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Best way to disconnect from ldap? John Gordon <gordon@panix.com> - 2012-03-21 19:30 +0000
  Re: Best way to disconnect from ldap? "J. Cliff Dyer" <jcd@sdf.lonestar.org> - 2012-03-21 16:21 -0400
  Re: Best way to disconnect from ldap? Chris Rebert <clp2@rebertia.com> - 2012-03-21 13:34 -0700
  Re: Best way to disconnect from ldap? Chris Kaynor <ckaynor@zindagigames.com> - 2012-03-21 13:54 -0700
  Re: Best way to disconnect from ldap? Tycho Andersen <tycho@tycho.ws> - 2012-03-22 08:14 -0500
    Re: Best way to disconnect from ldap? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-03-22 17:26 +0000
      Re: Best way to disconnect from ldap? Tim Chase <python.list@tim.thechases.com> - 2012-03-22 12:54 -0500
      Re: Best way to disconnect from ldap? Terry Reedy <tjreedy@udel.edu> - 2012-03-22 15:27 -0400
      Re: Best way to disconnect from ldap? Tycho Andersen <tycho@tycho.ws> - 2012-03-22 16:02 -0500
  Re: Best way to disconnect from ldap? Chris Rebert <clp2@rebertia.com> - 2012-03-22 06:27 -0700
  Re: Best way to disconnect from ldap? Tycho Andersen <tycho@tycho.ws> - 2012-03-22 09:00 -0500
  Re: Best way to disconnect from ldap? John Gordon <gordon@panix.com> - 2012-04-05 18:38 +0000
    Re: Best way to disconnect from ldap? Michael Ströder <michael@stroeder.com> - 2012-04-05 20:56 +0200

csiph-web