That is Python's type hinting. It's just syntactic sugar to help the developer reading your code get a sense of what type of input your function is expecting and what type of output it should return. Types to the left of ->
denote the input type, and types to the right of ->
denote the return type. In your example,
def testing(cha: List[Dict]) -> List[List[Dict]]:
...
testing
is a function that is supposed to accept a list named cha
which contains dictionaries and return a list which contains lists which in turn contain dictionaries. Something like this,
>>> testing([{'a':12, 'b':34}])
>> [[{'a':12, 'b':34}], [{'a':24, 'b':68}]]
That being said, Python is still a dynamically typed language and type hints don't add any compiler optimizations to your code. All type checking still happens at runtime. There is nothing stopping you from violating type hints of your function, which means I could pass any type of argument to testing
and it would still try to use it as valid input.