What is Type Hinting?

Type hinting is a formal solution to statically indicate the type of a value within your Python code. It was specified in PEP 484 and introduced in Python 3.5.

Credit: RealPython

Basically, It allows you to put the static type into Python code like Java , Typescript , etc.


def add(x):
    return x+1
        
print(add(1))
def add(x:float)->float:
    return x+1

print(add(1))

Pros and Cons

Pros

Cons

PS.