Skip to content

Instantly share code, notes, and snippets.

@ssanderson
Created October 25, 2015 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssanderson/e231b829cbaf20bb5045 to your computer and use it in GitHub Desktop.
Save ssanderson/e231b829cbaf20bb5045 to your computer and use it in GitHub Desktop.
assert statements dynamically look up the value of AssertionError in the current context
>>> AssertionError = ValueError
>>> assert False, "Assert Failed!"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Assert Failed!
>>> AssertionError = None
>>> assert False, "Assert Failed!"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment