Explain `d, self.deferred = self.deferred, None` idiom
|Reported by:||tom.prince||Owned by:||exarkun|
(diff, github, buildbot, log)
This common idiom should be explained.
if self.deferred is not None: d, self.deferred = self.deferred, None
That code sets d to self.deferred at the same time as setting self.deferred to None. That way, if the code is called again later, then self.deferred, the condition in the if evaluates to False. Also, it gets rid of the reference to the deferred, allow it and all its callbacks (including the captured closures) to be garbage collected.