I just stumbled upon this python code:
br: str = "check"
This kind of assignment I have never seen. I get that we make sure that the object br is of class 'str' in this case.
Are there any other benefits using the notation above?
I just stumbled upon this python code:
br: str = "check"
This kind of assignment I have never seen. I get that we make sure that the object br is of class 'str' in this case.
Are there any other benefits using the notation above?
This is an annotation for a variable.
Variable annotations are there to support third-party tooling, such as type checkers; the syntax is new in Python 3.6.
Just as for function annotations, the Python interpreter does not attach any particular meaning to variable annotations and only stores them in the annotations attribute of a class or module
check more at: https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep526