Hi Blair

> Looks pretty good. To streamline the usage and make the intent more
> apparent from a brief glance at the header you might consider turning it
> into a decorator, like

Thanks for the suggestion & the pointer. I'd not seen that page.

I don't think this is well suited to decorators, at least not with the
kinds of usages I am imagining. If you decorate a function, it's done once
and for all. So anyone who calls the function gets the single
one-size-fits-all decorated behavior. I'd rather the behavior was left in
the hands of the caller. That's kind of the point: give the caller flexible
control over what happens if something goes wrong, including passing in
your custom failure handler, etc.

Maybe a hybrid approach would be more useful: write a function which,
passed a function, returns a retrying version of that function that returns
a deferred that fires when the original function has succeeded (or
ultimately failed). The result could then be passed around, called by
multiple pieces of code, etc. Hmmm...

Thanks again.

Terry

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to