Hey there ๐! Today I am starting my day one with FastAPI programming. I have very little knowledge about Python and Django so, I think this is the good time for me to start.
Today I learnt about Type Hints,
Type Hints are nothing but defining the data types of the variables during the declaration. So that we will have required suggestions (Ctrl+Space) from the IDE like VS Code, Sublime text, etc.
suggestions when declaring variable without types hints:
suggestions when declaring variable with types hints:
Type Hints can be used for standard data types like int, str, float, bool, byte. In order to use the generic data types like dict, list, tuple, set we have to import typing module in our code.
from typing import List, Set, Tuple, Dict
Top comments (0)