Opened 2 years ago
Last modified 2 years ago
#23504 new enhancement
Fast assertions — at Version 1
Reported by: | roed | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.1 |
Component: | misc | Keywords: | sd87 |
Cc: | saraedum | Merged in: | |
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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...
Note: See
TracTickets for help on using
tickets.