What's this?
def sqr(v:int):
return v*v
It looks like type restriction, so this function takes just int values, but it doesn't. Is it just a decoration for debuggers?
What's this?
def sqr(v:int):
return v*v
It looks like type restriction, so this function takes just int values, but it doesn't. Is it just a decoration for debuggers?
This is the type hinting. It is not a restriction, it's a helper for other developers, most linters as mypy
and PyCharm linter also use this to prevent type errors. This feature is optional for using, but it helps you write more clean and testable code.