What is Type Annotation..? or in (or any other language) are used to indicate the Type Annotations type hints Python data types of variables and inputs/outputs of functions and methods. These are , as these expressions attached to them and are . expressions that are associated with variables or function/method arguments to make the code more readable for ourselves and the user do not have any meaning ignored by the interpreter What is the syntax of Type Annotations..? Type annotations have a straight-forward syntax i.e. . For example: variable_name : data_type name : str = 'Rohan'` age : int = 19 And for functions the syntax is: def function_name(argument_1 : data_type,argument_2 : data_type) -> return_type: function body For example: def sum(num_1 : int,num_2 : int = 3) -> int: # here 3 is the default value for the argument num_2 return num_1 + num_2 How is this useful..? First of all type annotations make the code more readable, as, even though these don't enforce the type on the variables and functions that cause a wrong type may lead to an error. these are a quick way to validate the actual type of the variables or arguments that are being passed to the functions Type annotations are never gonna raise an error if the given variable or argument doesn't have the correct type cause these are just and aren't enforced types. hinters Type annotations are used by code linters and if . using an IDE will always highlight the arguments if these aren't of the correct type There are third-party libraries like which can be used for static type checking. mypy Annotations can also be accessed using i.e.: function_name.__annotations__ def sum(num_1 : int,num_2 : int = 2) -> int: return num_1 + num_2 sum.__annotations__ # accessing the __annotations__ attribute of the function Output: {'num_1': <class 'int'>, 'num_2': <class 'int'>, 'return': <class 'int'>} Or taking a help on the function would yield a similar result too: def sum(num_1 : int,num_2 : int = 2) -> int: ''' A function that takes two integers as input and returns their sum ''' return num_1 + num_2 Now, if we do it will result in: help(sum) sum(num_1: int, num_2: int = 2) -> int A function that takes two integers as input and returns their sum So, we could also say that . type annotations are useful in documentation too For more information visit: Python documentation on type hints Geeks for Geeks tutorial on use cases of function annotations Conclusion We learned about type annotations or now that we know what these are it would be better to call these types of hints. Alongside all other benefits, these can also come in handy when debugging functions working based on the input arguments passed to it. Moreover, the fact that these are also used for documentation purposes it is a good habit to use these as it will not only be good for us to read through or get a but also for others to all those who are gonna use our code in the future. help documentation