[Twisted-Python] Deferred style question.

Bob Ippolito bob at redivi.com
Fri Jan 7 11:55:01 EST 2005

On Jan 7, 2005, at 6:51, Anthony Baxter wrote:

> On Friday 07 January 2005 21:24, Bob Ippolito wrote:
>> It's funny that you are using a decorator, but not the __contains__
>> operator ;)
> Pah! Here's a final version for now, fixed to work for methods and
> also supporting errbacks, as well as kwargs and unhashable arguments.
> The previous version didn't work for methods, because I was trying to 
> be
> too clever.

I would change the "if not opdef" to "if opdef is None", because it's a 
little faster and more precise.

> This is checked into shtoom (on a branch at the moment, since that's 
> where
> I need it). If people like, I can check it into the twisted sandbox 
> somewhere
> as well...
> If it's considered a good idea, I'm happy for this to go into twisted 
> proper.
> Now that I've got it, there's going to be a whole pile of places I can 
> use
> this.

Well, I think this or something like it should go in.  I've been using 
this idiom for years, actually.


More information about the Twisted-Python mailing list