[viff-devel] Weird behaviour

Janus Dam Nielsen janus.nielsen at alexandra.dk
Mon Aug 10 23:29:33 PDT 2009


A solution is to wrap the deferred in a datastructure, like an object,  
list, set, or what ever you prefer.


On 10/08/2009, at 23.40, Martin Geisler wrote:

> Janus Dam Nielsen <janus.nielsen at alexandra.dk> writes:
>
>> Hi Martin
>>
>> Thanks for your thoughts on this.
>
> You're welcome, it took a me a while to figure out what was wrong  
> here.
>
>>> I think the take-home message is that you have structured your code
>>> in an unusual way. Whenever you add a callback to a Deferred but  
>>> keep
>>> referring to the Deferred inside the callback, then you're off  
>>> track.
>>> At least that's my experience :-)
>> Actually I think you are slightly off :)
>>
>> Lets look at what the example does:
>> First, the Deferred a is created
>> Second, the callback r is created,
>> Third, a callback, append, is attached to a
>> Forth, r is added to values
>> Fifth, r is returned
>>
>> What seems to be the problem is the returning of a deferred from a
>> callback in combination with holding on to a reference to it in the
>> callback.
>
> Yes, when you return a Deferred, it loses its value. The value is
> transferred to the other Deferred.
>
> -- 
> Martin Geisler
>
> VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
> SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/.

____________________________________________________

Janus Dam Nielsen

R&D SCIENTIST, PhD.
CENTRE FOR IT-SECURITY

THE ALEXANDRA INSTITUTE LTD.

T +45 42 22 93 56
E janus.nielsen at alexandra.dk
W alexandra.dk
____________________________________________________

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.viff.dk/pipermail/viff-devel-viff.dk/attachments/20090811/916091d1/attachment.htm>


More information about the viff-devel mailing list