4 ms·
Here's another retry abstraction that in some ways is more general (decide whether to keep trying some other way, or sleep a bit before the next try, etc.): htt
by abecedarius 13y ago
Here's another retry abstraction that in some ways is more general (decide whether to keep trying some other way, or sleep a bit before the next try, etc.): https://github.com/darius/sketchbook/blob/master/misc/retrying.py https://github.com/darius/sketchbook/blob/master/misc/retryi...
A couple things look wrong in the OP's last snippet: shouldn't
ignore_small = ignore(ImageTooSmall)
be
ignore_small = lambda call: ignore(call, ImageTooSmall)
and similarly for the definition of http_retry?
- Suor 13y agoNo, @decorator takes care of it - http://funcy.readthedocs.org/en/latest/decorators.html http://funcy.readthedocs.org/en/latest/decorators.html
- abecedarius 13y agoOK, cool. Some feedback: I still don't understand what your @decorator does, after looking over that page, then finding the source code and finding it to call other functions with no doc comments, which call other functions with no doc comments, etc.; after about 3 levels I gave up, not interested enough. This on top of the blog post including it with no explanation. I've seen a @decorator function defined by Peter Norvig before, but it only propagated metadata, it didn't change the usual functionality of its argument.
- Suor 13y agoOh, I probably should spend some time clarifying the docs. But basically it just helps avoiding nesting functions, a common boilerplate when writing decorators.