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


Groups > comp.lang.python > #22023

Re: Best way to disconnect from ldap?

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 <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'cpython': 0.05; 'python': 0.08; '21,': 0.09; 'all?': 0.09; 'called.': 0.09; 'python-level': 0.09; 'am,': 0.12; '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; 'seems': 0.20; 'cheers,': 0.20; 'thus': 0.21; 'cc:no real name:2**0': 0.21; 'pointed': 0.21; 'header:In-Reply-To:1': 0.22; 'assume': 0.22; 'similarly': 0.23; 'though.': 0.23; 'fine': 0.24; '"this': 0.24; '(like': 0.26; 'classes': 0.26; 'stuff': 0.26; 'code': 0.26; 'producing': 0.28; 'message-id:@mail.gmail.com': 0.29; '(even': 0.29; 'cc:addr:python.org': 0.29; 'generally': 0.30; '22,': 0.30; 'behaves': 0.30; 'cycles': 0.30; 'chris': 0.30; 'subject:?': 0.31; 'thu,': 0.32; "i've": 0.32; 'does': 0.32; 'stopped': 0.32; 'typically': 0.32; 'changing': 0.32; 'there': 0.33; "can't": 0.33; 'it?': 0.33; 'light': 0.35; 'received:209.85.214': 0.36; 'cc:2**1': 0.36; 'reference': 0.37; 'received:google.com': 0.37; 'similar': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'enough': 0.38; 'somewhat': 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; 'paranoia': 0.84; 'sender:addr:chris': 0.84; 'immediately,': 0.91; 'subject:Best': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=kvFgrA4F237SdmVVWCvyHEVISv7/bL8elG8hVu7pfzU=; b=JJBVUtIg6R8Rhoq1nilwfFpTydRUrvG2naDfvSgxXOf+gkywQL4GgNI9eHLytjMs+n vdeFpdErf7pYHOxnHnmSHJ9nI6Wp9HvwKif4IGoPD6FXLGnVrvXs84ln8k7oFOrLg/lF wPW8/D/FWUUjQzXH22nljopjbd9vHwciYntFw=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=kvFgrA4F237SdmVVWCvyHEVISv7/bL8elG8hVu7pfzU=; b=FLNZ26pKCvPRzX2EgxyBXFwfRzjr0GfnpqNY989mYJLMdiQ8Gmqw3VK8ExoFyNkTXF Vs8KMAuBMUQxCUe6nlYCW3A7MjvogKUTKUTV5M0hni9d01jl40R6d+/ldbO2UlpBz/bo ie8ku2SchzfnjlxvJ5Z44K+M8Q+lRlTflbBVftWK9ochytNNI310Hkcidxjbx0FUsrzK RWuOxF1TjolNG3lH3NNk122mXV9Ozs7mPzwT6teKsD/tBBUsQeHoIVT50cr30ISN6Are ifUuboUN3IV0CD8r5CACFdq6tJRSUv5hSBDa49K+fNCwqsyZp+xeGCY3EeocfY2Qq893 gKuA==
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <20120322131447.GG19657@ccapuser-ubuntu.WICOURTS.GOV>
References <jkda88$mrk$1@reader1.panix.com> <CAMZYqRQR0VFweQgN8jb3wkx-opabvVQJy5zRtQQrv7tnnzivwA@mail.gmail.com> <CALvWhxvq-KO0ZxMwo-A7ieLyULHh95LAAiLon3zqBgMixZpFbA@mail.gmail.com> <4F6A4D02.6020403@tim.thechases.com> <20120322131447.GG19657@ccapuser-ubuntu.WICOURTS.GOV>
Date Thu, 22 Mar 2012 06:27:45 -0700
X-Google-Sender-Auth T3RaQcl0QqVjuwQceZw3uhLzkV8
Subject Re: Best way to disconnect from ldap?
From Chris Rebert <clp2@rebertia.com>
To Tycho Andersen <tycho@tycho.ws>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQneVCTC6N9sn9lxx52uHle4l3H1YqUxus3lGR53QlgddnEmKdQXFkNs5PqUR0uPnB7rvlJW
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.888.1332422868.3037.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1332422868 news.xs4all.nl 6914 [2001:888:2000:d::a6]:40563
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:22023

Show key headers only | View raw


On Thu, Mar 22, 2012 at 6:14 AM, Tycho Andersen <tycho@tycho.ws> wrote:
> 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?

Writing resource classes (like `file`) in C? Their __del__()s
typically involve little/less Python-level stuff and thus less
paranoia need be exercised.
There is somewhat of a perverse incentive in having such last-ditch
clean-up mechanisms though. "This code seems to work fine without
`with`, so why bother changing it?"

Cheers,
Chris

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