Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'cpython': 0.05; 'python': 0.08; '21,': 0.09; 'all?': 0.09; 'called.': 0.09; 'to:addr:python.list': 0.09; 'to:addr:tim.thechases.com': 0.09; 'to:name:tim chase': 0.09; 'c++': 0.12; '__del__': 0.16; 'destructor': 0.16; 'scope,': 0.16; 'subject:ldap': 0.16; 'warn': 0.16; 'cc:addr:python-list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'pointed': 0.21; 'received:209.85.210.174': 0.21; 'received:mail- iy0-f174.google.com': 0.21; 'header:In-Reply-To:1': 0.22; 'assume': 0.22; 'similarly': 0.23; 'cc:2**0': 0.26; 'producing': 0.28; '(even': 0.29; 'received:gov': 0.29; 'cc:addr:python.org': 0.29; 'generally': 0.30; 'behaves': 0.30; 'cycles': 0.30; 'chris': 0.30; 'subject:?': 0.31; "i've": 0.32; 'does': 0.32; 'stopped': 0.32; 'there': 0.33; "can't": 0.33; 'header:User-Agent:1': 0.33; 'it?': 0.33; 'light': 0.35; 'reference': 0.37; 'charset:us-ascii': 0.37; 'received:google.com': 0.37; 'similar': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'enough': 0.38; 'subject:from': 0.39; 'received:209': 0.39; 'more': 0.61; 'fact,': 0.63; 'guarantee': 0.66; 'gone': 0.68; '-0500,': 0.84; 'bitten': 0.84; 'immediately,': 0.91; 'subject:Best': 0.93 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=XPzO2glETkRhihZYV4IwDW5cO+KM9IPw3auq46mQE6I=; b=ocfakCTxgD0HUjbBMcJMk6gpVuu+UHbR3UsYhXTBph/zjpxrlSIrCUBo9tMcvbtMVo aHwIjDhdyZ8uQpu/D/+rq4+wfVdI+ZH/Lpl1hPIfGbhN16rrLVRs7j/m1d1K6Q5CuHz/ noCZp/4PIec4cLz11f3CWYQyflbO/36aZbi88wli9kjR9geFsoxwmJJlUwXHh5nLORi7 T1pyhfMW/vcuWkW1XZFMSSTkjjDbCSIjvBsqGCz+UZfb5zzOxQcNVTR7yv10jmCJAqt3 3qa2f8H9qz28JmtBnkT7ceeKT8BJH7T5Yk5Ti0aVtj3SsxpiRzV+3mgdPer6SnQ4RU5d s3NQ== Date: Thu, 22 Mar 2012 08:14:47 -0500 From: Tycho Andersen To: Tim Chase Subject: Re: Best way to disconnect from ldap? References: <4F6A4D02.6020403@tim.thechases.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F6A4D02.6020403@tim.thechases.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQk5D56ouVevNkCnGQ1qKg/4VaXEBPhtXP1ek8HAXYabj/88CMUWXgoLV8drUVta+kc3DgKb Cc: python-list@python.org 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1332422068 news.xs4all.nl 6845 [2001:888:2000:d::a6]:60641 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22021 On Wed, Mar 21, 2012 at 04:49:54PM -0500, Tim Chase wrote: > On 03/21/12 15:54, Chris Kaynor wrote: > >As Chris Rebert pointed out, there is no guarantee as to when the > >__del__ method is called. CPython will generally call it immediately, > >however if there are reference cycles it may never call it > > And more maddeningly, modules/objects used/called from within the > __del__ may have already gone out of scope, producing > head-scratching errors. I've been bitten by this enough times that > I just stopped using __del__ completely. I've had similar experiences. In fact, in light of all this - why does __del__ exist at all? Novice python users may (reasonably) assume it behaves similarly to a C++ destructor (even though the docs warn otherwise). Given that you can't trust __del__, is there a legitimate use case for it? \t