skip to navigation
skip to content

stfu 1.2

STFU those exceptions (explicitly)

Silence chosen exceptions.

Author: João Bernardo Oliveira - @jbvsmo

Replacement for the idiom:

>>> try:
...     may_raise_exception()
... except Exception:
...     pass

Just write:

>>> with stfu:
...     may_raise_exception()
>>> with stfu(TypeError, ValueError):
...     may_raise_exception()

To catch everything (even KeyboardInterrup and StopIteration):

>>> with stfu_all:
...     may_raise_any_exception()
“Errors should never pass silently.
Unless explicitly silenced.” :)
 
File Type Py Version Uploaded on Size
stfu-1.2.tar.gz (md5) Source 2013-03-15 1KB
stfu-1.2.zip (md5) Source 2013-03-15 1KB