Dustin,

> No, this is simply incorrect.  'del myThingy' simply removes
> a reference to the object to which myThingy refers.

Argh. I'm assuming, as in the example, that the only strong reference to myThingy is the one I own.

> the Broker keeps a Python reference to the object internally,
> preventing the reference count from reaching zero,
> preventing the object from being deleted.

I understand that. I'm trying to ask if that's how it _should_ work. If I have a resource and make a Referenceable to give you access to it, it doesn't really make sense to me that my resource should be kept alive just because you have that access. It seems more reasonable to me that your access object should reference my resource _weakly_ and that you should receive some kind of notification if and when the resource expires.

It's just like the case of a GUI and a business logic object. The GUI probably gets a reference to the business logic object so that eg. button pushes can invoke methods on the object. However, that reference should probably be weak so that the business logic object can be garbage collected when it's finished with its business. There's no sense (to me) in keeping an object alive because a GUI, logger, or other observer is observing it. Am I just wrong?

Daniel


On Mon, Aug 18, 2014 at 2:18 PM, Dustin J. Mitchell <dustin@v.igoro.us> wrote:
On Mon, Aug 18, 2014 at 3:37 PM, Daniel Sank <sank.daniel@gmail.com> wrote:
> and I send you the Referenceable. Now suppose I do
>
> del myThingy
>
> Now myThingy will be garbage collected.

No, this is simply incorrect.  'del myThingy' simply removes a
reference to the object to which myThingy refers.

If and only if that's the last reference (as determined by Python's
reference counting), it is deleted.  As glyph said, as long as there
is an outstanding remote reference, the Broker keeps a Python
reference to the object internally, preventing the reference count
from reaching zero, preventing the object from being deleted.

Dustin

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



--
Daniel Sank
Department of Physics
Broida Hall
University of California
Santa Barbara, CA 93117
(805)893-3899