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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for exception_safe-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b2d133a21da51f26e726851d5da85838b3ff8480cad68b5e4ec838f72f13350 |
|
MD5 | 81af5fb33f110806a8771d4985a7927d |
|
BLAKE2b-256 | 60052f26edee5c1094a3a0e5227a6252c1e100aeff6588cff88d6bd18240db27 |