[Twisted-Python] DeferredDict, defaultdict, map/reduce, silliness

Valentino Volonghi dialtone at gmail.com
Tue Nov 4 02:49:05 EST 2008


On Nov 2, 2008, at 6:06 PM, Terry Jones wrote:

> This isn't meant to be taken too seriously - perhaps just food for  
> someone
> else to chew on while trying to relax...
>
> I was thinking the other night about what a DeferredDict might look  
> like,
> what it might be useful for, if anything, etc. We have DeferredList of
> course, so why not a dict?  Then I also remembered  
> collections.defaultdict
> and couldn't resist the appeal of trying  
> defaultdict(defer.Deferred).  That
> thinking led to the map/reduce silliness below. I don't know that it  
> leads
> anywhere - I was just playing around.


This is actually a very very nice pattern. I can see it making my  
mapreduce
"example" code
<http://bazaar.launchpad.net/%7Edialtone/ampoule/main/annotate/16?file_id=client.py-20081029001234-rlmor7coth4g8s5d-3 
 >  (line 98 and following) a bit easier and maybe even generic enough
that I can package it as a library.

-- 
Valentino Volonghi aka Dialtone
Now running MacOS X 10.5
Home Page: http://www.twisted.it
http://www.adroll.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20081103/53135425/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20081103/53135425/attachment.pgp 


More information about the Twisted-Python mailing list