Created
September 20, 2019 14:03
-
-
Save bennuttall/a461009c39a779e4361e2a3881708233 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
import warnings | |
class MyWarning(Warning): | |
pass | |
warnings.warn( | |
'this ' | |
'is ' | |
'a ' | |
'warning', | |
MyWarning | |
) |
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
import warnings | |
class MyWarning(Warning): | |
pass | |
warnings.warn( | |
MyWarning( | |
'this ' | |
'is ' | |
'a ' | |
'warning' | |
) | |
) |
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
import warnings | |
class MyWarning(Warning): | |
pass | |
message = "This is a warning" | |
warnings.warn( | |
message, | |
MyWarning | |
) |
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
import warnings | |
class MyWarning(Warning): | |
pass | |
message = "This is a warning" | |
warnings.warn(message, MyWarning) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output: