Skip to content

Instantly share code, notes, and snippets.

@SyntaxColoring
Last active December 4, 2021 04:36
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 SyntaxColoring/ad2e66aed50a3c9e0c721ba8098a0908 to your computer and use it in GitHub Desktop.
Save SyntaxColoring/ad2e66aed50a3c9e0c721ba8098a0908 to your computer and use it in GitHub Desktop.
class Foo:
bar: int
reveal_type(Foo().bar) # OK, builtins.int
reveal_type(Foo.bar) # mypy says builtins.int,
# but I expected this to be an error.
print(Foo.bar) # Passes type-checking and raises AttributeError at runtime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment