-1

What does -> do in Python? Can't seem to find anything with a search. Most I can guess is that it creates an alias of some kind.

def function(parameters) -> str

or

format(...)
      S.format(*args, **kwargs) -> str
givonz
  • 187
  • 9
  • Thanks for the links to existing answers. How come when I search for "python ->" or "python '->'" they don't come up? – givonz Jan 31 '20 at 12:28

1 Answers1

1

In python 3.5+ optioinal typing was included. Mypy is the library used for extra typing support. After a function declaration "->" is used to specify the type of what the function returns.