use of colon symbol in python [duplicate]
Solution 1:
You are looking at an annotation for a variable. The hint is moved to the __annotations__
mapping:
>>> char: str
>>> __annotations__
{'char': <class 'str'>}
Variable annotations are there to support third-party tooling, such as type checkers; the syntax is new in Python 3.6.
See PEP 526 -- Syntax for Variable Annotations, and What's 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.