79231300

Date: 2024-11-27 17:30:17
Score: 0.5
Natty:
Report link

You can enable type checking in Colab in the menu Tools > Setting > Editor > (at the bottom) "Syntax and type checking". It then underlines errors in red and hovering them (or Alt+F8) displays the message.

As @jakevdp answered, this is an external tool: types are just annotation with usually no effect at runtime (except for code that actually inspects them).

The type checker in Colab seems not to be documented anywhere, but it's Pyright. In case anyone needs to change its configuration from a Colab notebook, that's possible with e.g.:

%%writefile pyproject.toml
[tool.pyright]
typeCheckingMode = "strict"

(run the cell to overwrite pyproject.toml and wait a bit or save the notebook for Pyright to be re-executed).

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @jakevdp
  • Low reputation (0.5):
Posted by: Marcin Wrochna