Type Annotation In Pythonby@h3avren
3,752 reads

Type Annotation In Python

tldt arrow
Read on Terminal Reader🖨️

Too Long; Didn't Read

Type annotations are used to indicate the types of variables and inputs/outputs of functions and methods in Python. Type annotations have a straight-forward syntax i.e. `variable_name : data_type` These are associated with variables or function/method arguments to make the code more readable for ourselves and the user**. These expressions do not have any meaning attached with them and these are **ignored by the interpreter**** These are never gonna raise an error if the given variable or argument doesn't have the correct type cause these are just ***hinters*** def sum(num_1 : int,num_2 : int = 2) -> int: return num_1 + num_2

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Type Annotation In Python
Ajay Singh Rana HackerNoon profile picture

@h3avren

Ajay Singh Rana

About @h3avren
LEARN MORE ABOUT @H3AVREN'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa