[Twisted-Python] Retrying function calls

Blair Bethwaite blair.bethwaite at gmail.com
Sun Nov 1 18:46:38 EST 2009


Hi Terry,

2009/11/1 Terry Jones <terry at jon.es>:
<SNIP>
> My questions are: Is this robust? Can/should it be improved?  Any criticism
> of the code (especially wrt Twisted best practices) would be very welcome.

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
http://wiki.python.org/moin/PythonDecoratorLibrary#Retry - the retry
method there is simpler than yours but easy to extend beyond the
flip-flop scenario it currently caters for. I have also been doing
some work using the AWS query APIs and a minor variant of that
decorator now holds a high position in my Python tool belt module.

Regards,
~Blair

-- 
In science one tries to tell people, in such a way
as to be understood by everyone, something that
no one ever knew before. But in poetry, it's the
exact opposite.
 - Paul Dirac



More information about the Twisted-Python mailing list