~/Blog

Brandon Rozek

Photo of Brandon Rozek

PhD Student @ RPI studying Automated Reasoning in AI and Linux Enthusiast.

Python Typing

Published on

Updated on

Warning: This post has not been modified for over 2 years. For technical posts, make sure that it is still relevant.

There’s a typing module built right into Python that you can use on your applications. Sobolevn write a great blog post about it. One thing that threw me off at first is that if you add type annotations and then run python like you normally would, it would act as if the annotations weren’t there.

Why use type annotations then?

  1. It enhances your internal docs. VS Code and other editors pick this up and show it to the user in their IDE.
  2. You can use mypy to perform type checking for you.

I go back and forth with type checking in Python, but I do think that forcing yourself to follow type safety makes you a better programmer.

Reply via Email Buy me a Coffee
Was this useful? Feel free to share: Hacker News Reddit Twitter

Published a response to this? :