[Twisted-Python] Returning a deferred, maybe

Wilfredo Sánchez Vega wsanchez at wsanchez.net
Thu Jun 15 19:40:59 EDT 2006

   We have several functions in the code which return either a  
synchronous value or a deferred.  In these cases, the caller has to  
either inspect the return type and do different things depending  
whether the value is available right then, or call the function using  

   It seems like you can save the caller some grief by ensuring that  
you always return a deferred value (eg. by wrapping a synchronous  
result with defer.succeed(), as suggested in http://twistedmatrix.com/ 
projects/core/documentation/howto/gendefer.html).  Should this be an  
encouraged practice?


More information about the Twisted-Python mailing list