Skip to content

Instantly share code, notes, and snippets.

@Kangaroux
Created June 11, 2020 19:38
Show Gist options
  • Save Kangaroux/d2341c42d48c8cd312f3c8c409a3be40 to your computer and use it in GitHub Desktop.
Save Kangaroux/d2341c42d48c8cd312f3c8c409a3be40 to your computer and use it in GitHub Desktop.
# Declare a variable and use it later.
foo: int
# ...
foo = 5
# Add type hints for function arguments and return types.
def say_hello(name: str) -> str:
return f"Hello {name}!"
# Declare fields on a class instead of using __slots__.
class MyClass:
field_a: str
field_b: bool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment