Last active
December 22, 2020 11:13
-
-
Save att288/92e6f7bc1e8dc99abc9c8ce7ac3a3d38 to your computer and use it in GitHub Desktop.
This file contains 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
class Example: | |
class_attr_1: str = 'attr_1' | |
@classmethod | |
def foo(cls, message: str) -> None: | |
print(f"Message sent from foo: {message}") | |
# access class attribute | |
print(cls.class_attr_1) | |
# call static method bar from a class method | |
cls.bar('(from foo) BAR') | |
@staticmethod | |
def bar(message: str) -> None: | |
print(f"Message sent from bar: {message}") | |
if __name__ == "__main__": | |
Example.foo("FOO") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment