Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add default value for the 'silent' func #146

Closed
wants to merge 1 commit into from

Conversation

maiyajj
Copy link

@maiyajj maiyajj commented Jan 18, 2024

No description provided.

@Suor
Copy link
Owner

Suor commented Jan 18, 2024

This API is non-traditional, in the spirit of the rest of the lib one would expect silent() to be a decorator with an optional argument:

silent_func = silent(func)
silent_func_with_def = silent(default=42)(func)

# or
@silent(default=42)
def func(...):
    return ...

But then it's quite easily replaced with ignore(Exception, 42), which only slightly longer. And silent(default)(func) will be an ambiguous API if default is callable.

@Suor Suor closed this Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants