Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'context': 0.04; 'received:verizon.net': 0.07; 'sanity': 0.07; 'terry': 0.07; 'python': 0.08; 'namespace': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; ';-)': 0.12; '__del__': 0.16; 'cyclic': 0.16; 'deletions.': 0.16; 'methods,': 0.16; 'reedy': 0.16; 'subject:ldap': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'jan': 0.19; '(which': 0.19; 'header:In-Reply-To:1': 0.22; 'versions': 0.23; 'explicit': 0.29; 'pm,': 0.29; 'definition': 0.30; 'pretty': 0.31; 'subject:?': 0.31; 'thu,': 0.32; "i've": 0.32; 'does': 0.32; 'there': 0.33; "can't": 0.33; 'header:User-Agent:1': 0.33; 'it?': 0.33; 'object': 0.33; 'header:X-Complaints-To:1': 0.34; 'steven': 0.34; 'frustrated': 0.34; 'to:addr:python-list': 0.35; 'things': 0.35; '(for': 0.35; 'received:org': 0.36; 'some': 0.38; 'useful': 0.38; "i'd": 0.39; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'more': 0.61; 'managers': 0.62; 'sick': 0.73; 'saving': 0.78; '-0500,': 0.84; 'readily': 0.93; 'subject:Best': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Best way to disconnect from ldap? Date: Thu, 22 Mar 2012 15:27:37 -0400 References: <4F6A4D02.6020403@tim.thechases.com> <4f6b60b2$0$29981$c3e8da3$5496439d@news.astraweb.com> <4F6B6755.7000104@tim.thechases.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <4F6B6755.7000104@tim.thechases.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1332444484 news.xs4all.nl 6948 [2001:888:2000:d::a6]:44034 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22042 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