[Twisted-Python] __nonzero__ for Deferred

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Wed Mar 18 18:50:58 MDT 2015


On 18 Mar, 10:03 pm, glyph at twistedmatrix.com 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?

Er.  What?  It's a little early for april fools' day, isn't it?

Seriously, this is weird.  Am I missing something?

Can expand on what it would mean to deprecated a special method of a 
class that doesn't even define it and what makes Deferred unique among 
all user-defined classes in this regard.

Jean-Paul




More information about the Twisted-Python mailing list