Python3 function definition, arrow and colon [duplicate]
问题 This question already has answers here : What does -> mean in Python function definitions? (8 answers) Closed 2 years ago . I have found the following python function definition: def reverseString(self, s: 'List[str]') -> 'None': I don't quite understand 'List[str]' and -> 'None' . I have found that the arrow is a function annotation but I couldn't find anything useful and understandable for List[str]. Is it just an annotation? or does it enforce that the type of parameter s must be a string