0
Function argument type in python
Hi Refer code below: It has one method which has arg of type int. Why it allows string to be passed as argument If argument type cannot be provided, why it works with :int in function parenthesis https://sololearn.com/compiler-playground/c1cKyanINc7h/?ref=app
3 Answers
+ 4
type annotation is documentation â NOT type checking
+ 3
Also, Sololearn is not an ide.
A proper ide would give you warnings, or little red squiggly lines.
But yes, it will still be evaluated . Python is dynamically typed. Type annotations is just a way to enable your ide to remind you of the expected types you previously assigned to the variables in your code.