> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:python-
> [EMAIL PROTECTED] On Behalf Of John Machin
> Sent: Friday, January 11, 2008 4:08 PM
> To: python-list@python.org
> Subject: Re: Newbie question on Classes
> 
> On Jan 11, 9:27 am, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote:
> > > -----Original Message-----
> > > From: [EMAIL PROTECTED]
[mailto:python-
> > > [EMAIL PROTECTED] On Behalf Of Adrian Wood
> > > Sent: Thursday, January 10, 2008 4:47 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: Newbie question on Classes
> >
> >
> > How about searching the garbage collector?
> 
> Not a good idea, because gc is an implementation artifact and in fact
> is specific to the C Python implementation; you won't find it in e.g.
> Iron Python or Jython.
> 

a) I forgot the ';-)' and/or <tongue_in_cheek> tag.

b) It was junk code.  A cleaner loop would be (which I figured out 5
minutes after posting =P ):
        for i in gc.get_objects():
                if isinstance(i, Person):
                        print i.__class__, "%x" % id(i), i.SomeMethod()

c) It's good to know about GC being CPython only.

d) You forgot to mention the problem that some of the objects could be
'deleted' but not garbage collected yet.

e) Most importantly, anyone who is using the garbage collector as their
object manager isn't into proper coding practices in the first place.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to