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

Fast assertions #23504

Open
roed314 opened this issue Jul 21, 2017 · 1 comment
Open

Fast assertions #23504

roed314 opened this issue Jul 21, 2017 · 1 comment

Comments

@roed314
Copy link
Contributor

roed314 commented Jul 21, 2017

It would be cool to have an assertion that was possible to turn on and off, and that weren't caught by except Exception. For example:

class Assertion_Error(BaseException):
    pass
def assert_(F, msg=None, args=(), kwds={}):
    if not callable(F):
        raise ValueError("Must use a callable")
    if assertions_enabled and not F(*args, **kwds):
        raise Assertion_Error(msg)

One could probably also have msg be lazy as well...

CC: @saraedum

Component: misc

Keywords: sd87

Issue created by migration from https://trac.sagemath.org/ticket/23504

@roed314 roed314 added this to the sage-8.1 milestone Jul 21, 2017
@saraedum

This comment has been minimized.

@mkoeppe mkoeppe removed this from the sage-8.1 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants