Catch all exceptions and return None
Project description
Safe
This is quite a simple package. It catches all exceptions within a given callable and returns None, if they occur and the return-value of the callable if not.
def boom():
raise Exception()
return 1
def non_boom():
return 2
a = safe(lambda: boom())
b = safe(lambda: non_boom())
assert a == None
assert b == 2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
exception_safe-0.0.3.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for exception_safe-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46648f78d24c3bc6b1d2963e74346506a5a045f3f27ed9284229a410ef124570 |
|
MD5 | 03c00334ebed0821990d27b6d602fb24 |
|
BLAKE2b-256 | d0db44193f797c1d509db5192e6972102b1ed6f3b4b30c0dd0f8a61a6d1b8437 |