[Twisted-Python] Is there pb documentation somewhere?
Dustin J. Mitchell
dustin at v.igoro.us
Mon Aug 18 17:30:06 MDT 2014
Indeed, what you're expecting is very much against the design of PB.
Dustin
On Mon, Aug 18, 2014 at 5:25 PM, Daniel Sank <sank.daniel at gmail.com> wrote:
> 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 at v.igoro.us>
> wrote:
>
>> On Mon, Aug 18, 2014 at 3:37 PM, Daniel Sank <sank.daniel at 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 at 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
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20140818/23365e4f/attachment-0002.html>
More information about the Twisted-Python
mailing list