Python is not as statically typed language but we can specify the type of a variable.
Do you use this feature and if it's the case why and how ?
python - When/why use types from typing module for type hints - Stack Overflow
Python Type Hints and why you should use them.
Pycharm SQLAlchemy Plugin adds typing support for Mapped columns : Python
Python true static typing:Python
Videos
The "right" way is to use builtins when possible (e.g. dict over typing.Dict). typing.Dict is only needed if you use Python < 3.9. In older versions you couldn't use generic annotations like dict[str, Any] with builtins, you had to use Dict[str, Any]. See PEP 585
There is no big difference between typing.Dict and dict.
Just typing.Dict is actually a Generic Type, so it allows you to specify subtypes inside the brackets.
Like:
from typing import Dict
def func_1(arg_one: Dict[str, int]) -> Dict:
pass
But typing.Dict is only necessary if your Python version is under 3.9. Other wise you could do the same with regular dicts.
Example Python >= 3.9:
def func_1(arg_one: dict[str, int]) -> dict:
pass
https://blog.jonathanchun.com/2025/02/16/to-type-or-not-to-type/
I wrote this blog post as I've seen a lot of newer developers complain about Type hints and how they seem unnecessary. I tried to copy-paste a short excerpt from the blog post here but it kept detecting it as a question which is not allowed, so decided to leave it out.
I know there's plenty of content on this topic, but IMO there's still way too much untyped Python code!