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.niel...@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.niel...@alexandra.dk
W alexandra.dk
____________________________________________________

_______________________________________________
viff-devel mailing list (http://viff.dk/)
viff-devel@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk

Reply via email to