On 03/18/2015 06:03 PM, Glyph Lefkowitz wrote:
I'd like to deprecate and remove __nonzero__ on Deferreds. Occasionally I see code where someone
(maybe even me) does "if d:" where they should have been doing "@d.addCallback def
cb(result): if result: ...".
Anybody else have this issue? Objections?
How does this interact with code that uses None as a sentinel?
I have code where I shoot off a recurring process, but want to wait when the
first run completes. I do something along the lines of:
d = Deferred()
... setup everything so it calls my callback every time the loop completes ...
if d:
d.callback("first time completed!")
d = None
while most of my code uses the check "if d is not None", not all of it does
(especially the older code).
--Justin
_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python