Last active
February 15, 2017 19:55
-
-
Save copyrighthero/d8963461f22ef5064fb9003dbf818cf0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exceptions | |
# Throw some errors with one line of lambda | |
# using the generator objects' throw method | |
_ERROR = lambda _ = "": (_ for _ in ()).throw(AssertionError("Some Error Occured" + _.__str__())) | |
_ERROR = lambda _ = "": (lambda:(yield _))().throw(AssertionError("Some Error Occured" + _.__str__())) | |
# So that you can do this | |
a = b if c else _ERROR() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment