Sometimes you just need to put a diaper on it.
The diaper pattern, in its natural form:
def error_hider():
try:
do_something(arg1, arg2=True)
except:
pass
New and "improved" (cough)
import diaper
diaper(do_something, arg1, arg2=True)
# or, if you want, you can wrap a whole block of crap
with diaper:
do_something(arg1, arg2=True)
# what diaper invocation would be complete without a little silliness
with diaper as nappy:
assert diaper is nappy, "...in some parts of the world"
I guess that's up to you...
- Original implementation by Milan Falešník
- Context manager support and module created by Sean Myers
- Diaper 'smell' concept courtesy of Michael Hrivnak