While watching a video about Python features, I came across the following code snippet: def compose[_First, _Second, _Thirt]( first: Callable[[_First], _Second], second: Callable[[_Second], _Third], ) -> Callable[[_First], _Third]: return lambda x: second(first(x)) I’m curious about the syntax with square brackets right after the function name, specifically [_First, _Second, _Third]. What is this syntax called? When and how is it used in Python? P.S. Summary for future readers: This is called Type Parameter Syntax It was introduced in Python 3.12 and is detailed in PEP 695 A partial answer to the question is provided in this article on SO This specific case is described in the documentation on generic functions Continue reading...