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


Groups > comp.lang.python > #64525

Re: Self healthcheck

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'exists.': 0.07; 'wednesday,': 0.07; '22,': 0.09; 'identifier': 0.09; 'may,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'will,': 0.09; 'def': 0.12; 'wrote': 0.14; 'corresponds': 0.16; 'deleted,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:Self': 0.16; 'uniquely': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'later': 0.20; 'memory': 0.22; 'creating': 0.23; 'circular': 0.24; 'question': 0.24; 'header:X-Complaints-To:1': 0.27; 'that.': 0.31; 'them?': 0.31; 'class': 0.32; 'probably': 0.32; 'skip:c 30': 0.32; 'sense': 0.34; 'skip:_ 10': 0.34; 'skip:d 20': 0.34; 'could': 0.34; 'problem': 0.35; 'created': 0.35; 'objects': 0.35; 'but': 0.35; 'there': 0.35; 'thanks': 0.36; 'january': 0.37; 'las': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'most': 0.60; 'different': 0.65; 'frank': 0.68; 'special': 0.74; 'do:': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dave Angel <davea@davea.name>
Subject Re: Self healthcheck
Date Wed, 22 Jan 2014 13:40:21 -0500 (EST)
Organization news.gmane.org
References <0d1fc1a7-c585-45ba-8c1a-0cc468712a48@googlegroups.com> <mailman.5829.1390360114.18130.python-list@python.org> <58c541ab-c6e1-45a8-b03a-8597ed7ecb48@googlegroups.com> <mailman.5832.1390381001.18130.python-list@python.org> <9729ddaa-5976-4e53-8584-6198b47b6789@googlegroups.com>
X-Gmane-NNTP-Posting-Host dpc6744192108.direcpc.com
X-Newsreader PiaoHong Usenet NewsReaders 1.36
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.5847.1390415890.18130.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390415890 news.xs4all.nl 2857 [2001:888:2000:d::a6]:53859
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64525

Show key headers only | View raw


 Asaf Las <roegltd@gmail.com> Wrote in message:
> On Wednesday, January 22, 2014 10:56:30 AM UTC+2, Frank Millman wrote:
>> 
>> class MainObject:
>>     def __init__(self, identifier):
>>          self._del = delwatcher('MainObject', identifier)
>> class delwatcher:
>>     def __init__(self, obj_type, identifier):
>>         self.obj_type = obj_type
>>         self.identifier = identifier
>>         log('{}: id={} created'.format(self.obj_type, self.identifier))
>>     def __del__(self):
>>         log('{}: id={} deleted'.format(self.obj_type, self.identifier))
>> If you do find that an object is not being deleted, it is then 
>> trial-and-error to find the problem and fix it. It is probably a circular 
>> reference
>> 
>> Frank Millman
> 
> Thanks Frank. Good approach! 
> 
> One question - You could do:
> class MainObject:
>     def __init__(self, identifier):
>          self._del = delwatcher(self)
> then later 
> 
> class delwatcher:
>     def __init__(self, tobject):
>         self.obj_type = type(tobject)
>         self.identifier = id(tobject)
>         ...
> 
> when creating delwatcher. Was there special reason to not to use them?
> is this because of memory is reused when objects are deleted 
> and created again so same reference could be for objects created 
> in different time slots?
> 

I couldn't make sense of most of that.  But an ID only uniquely
 corresponds to an object while that object still exists.  The
 system may,  and will, reuse iD's constantly. 

-- 
DaveA

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


Thread

Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-21 18:51 -0800
  Re: Self healthcheck Chris Angelico <rosuav@gmail.com> - 2014-01-22 14:08 +1100
    Re: Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-22 00:18 -0800
      Re: Self healthcheck Nicholas Cole <nicholas.cole@gmail.com> - 2014-01-22 08:43 +0000
        Re: Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-22 07:51 -0800
      Re: Self healthcheck "Frank Millman" <frank@chagford.com> - 2014-01-22 10:56 +0200
        Re: Self healthcheck Asaf Las <roegltd@gmail.com> - 2014-01-22 08:03 -0800
          Re: Self healthcheck Dave Angel <davea@davea.name> - 2014-01-22 13:40 -0500
          Re: Self healthcheck "Frank Millman" <frank@chagford.com> - 2014-01-23 07:36 +0200

csiph-web