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

This module could be a better suppress from contextlib, maybe #44

Open
DEVNULLDNE opened this issue Nov 24, 2021 · 0 comments
Open

This module could be a better suppress from contextlib, maybe #44

DEVNULLDNE opened this issue Nov 24, 2021 · 0 comments

Comments

@DEVNULLDNE
Copy link

I really don't know how suppress or this code work and if I get the time I'll look into it. But, I want a suppress that doesn't stop execution of a block of code when an error it is supposed to suppress occurs. So instead of this which is an excerpt from a decorator I was making:

with suppress(AttributeError): f_wrapper.__defaults__ = f.__defaults__
with suppress(AttributeError): f_wrapper.__kwdefaults__ = f.__kwdefaults__
with suppress(AttributeError): f_wrapper.__annotations__ = f.__annotations__
with suppress(AttributeError): f_wrapper.__module__ = f.__module__
with suppress(AttributeError): f_wrapper.__dict__.update(f.__dict__)

I would like this:

with fuckit(AttributeError):
    f_wrapper.__defaults__ = f.__defaults__
    f_wrapper.__kwdefaults__ = f.__kwdefaults__
    f_wrapper.__annotations__ = f.__annotations__
    f_wrapper.__module__ = f.__module__
    f_wrapper.__dict__.update(f.__dict__)

Just an idea, and thanks for looking.
Also, maybe FUCET for a module rename if you want: fully unregulated context error trampler

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

No branches or pull requests

1 participant