Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
srathi
· 8y ago · 0 comments
I've used decorators mainly to retry a function if it throws an exception, like retrying DNS queries multiple times, etc. I've never got a chance to do more with them, but this article gives me an incentive to try more.
Comments
[–]
sheraz
8y ago
Yep. I do the exact thing for a lot of network related things (dns lookups, http requests). I use this nifty library:
https://github.com/jd/tenacity
[–]
creeble
8y ago
Wow, both terrific tips, thanks!
[–]
mewwts
8y ago
That never crossed my mind. Neat trick!