From e0f293c6e4ef7964b2006c2e0d8aa212b7f731aa Mon Sep 17 00:00:00 2001 From: chenghao028935 Date: Thu, 18 Jan 2024 13:12:10 +0800 Subject: [PATCH] feat: add default value for the 'silent' func --- funcy/flow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/funcy/flow.py b/funcy/flow.py index 85c5a8e..8d7cfff 100644 --- a/funcy/flow.py +++ b/funcy/flow.py @@ -46,9 +46,9 @@ def wrapper(*args, **kwargs): return wrapper return decorator -def silent(func): +def silent(func, default=None): """Alters function to ignore all exceptions.""" - return ignore(Exception)(func) + return ignore(Exception, default=default)(func) ### Backport of Python 3.7 nullcontext