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


Groups > comp.lang.python > #64706

Re: Class and instance related questions.

From Dave Angel <davea@davea.name>
Subject Re: Class and instance related questions.
Date 2014-01-24 18:58 -0500
Organization news.gmane.org
References <b781b5d3-5dc0-4a7e-9792-78aadf2d6ab4@googlegroups.com> <mailman.5949.1390581460.18130.python-list@python.org> <2c8035fe-7514-4598-9497-c2f90f9291c2@googlegroups.com> <mailman.5952.1390596339.18130.python-list@python.org> <7f93cb3d-576c-4929-a815-2a5ea4fcf732@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.5955.1390607789.18130.python-list@python.org> (permalink)

Show all headers | View raw


 Asaf Las <roegltd@gmail.com> Wrote in message:
> On Friday, January 24, 2014 10:45:30 PM UTC+2, Chris Angelico wrote:
>> On Sat, Jan 25, 2014 at 7:32 AM, Asaf Las <r....@gmail.com> wrote:
>> > On Friday, January 24, 2014 6:37:29 PM UTC+2, Chris Angelico wrote:
>> 
>> >> It's possible to unbind the name, but every instance retains a
>> >> reference to its class, so the class itself won't disappear until
>> >> there are no instances left of it.
>> >> ChrisA
>> 
>> > That is interesting. Is it also reference count mechanism or something else?
>> 
>> Yes. [1]
>> 
>> ChrisA
>> 
>> [1] Within the bounds of the question asked, I think a simple "Yes" is
>> more useful here than a long and detailed explanation of the many
>> Pythons and how not all of them refcount at all. Consider this
>> footnote my apology to the experts who would otherwise feel that I'm
>> majorly misleading the OP. Sorry.
> 
> Chris, i like answers which open doors to my curiosity :-)
> yet i should spend my credits very carefully :-)
> 
Rather than dwelling on reference counting,  which is just one
 mechanism for identifying and disposing of objects,  it's usually
 more fruitful to consider what it means to be unreferenced.
 

The usual term is "reachable. "  If an object cannot be reached by
 following some chain of references,  starting from a small list
 of kernel items,  then it should be freed. The cheap way of
 noticing some such objects is by noticing the reference count go
 to zero. That's not enough,  however,  so you also need to
 periodically run a sweep type of garbage collector. See if you
 can guess why reference count alone is inadequate.
 

The CPython system uses both of these,  but other implementations
 do not. I believe that I've heard that the jython system does
 nothing at all, just letting the Java runtime handle it.
 


-- 
DaveA

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


Thread

Class and instance related questions. Asaf Las <roegltd@gmail.com> - 2014-01-24 08:31 -0800
  Re: Class and instance related questions. Chris Angelico <rosuav@gmail.com> - 2014-01-25 03:37 +1100
    Re: Class and instance related questions. Asaf Las <roegltd@gmail.com> - 2014-01-24 12:32 -0800
      Re: Class and instance related questions. Chris Angelico <rosuav@gmail.com> - 2014-01-25 07:45 +1100
        Re: Class and instance related questions. Asaf Las <roegltd@gmail.com> - 2014-01-24 13:03 -0800
          Re: Class and instance related questions. Chris Angelico <rosuav@gmail.com> - 2014-01-25 08:18 +1100
            Re: Class and instance related questions. Asaf Las <roegltd@gmail.com> - 2014-01-24 14:08 -0800
          Re: Class and instance related questions. Dave Angel <davea@davea.name> - 2014-01-24 18:58 -0500
      Re: Class and instance related questions. Terry Reedy <tjreedy@udel.edu> - 2014-01-24 20:08 -0500

csiph-web