Prateek wrote: > Hi > > Whenever I use help(input) inside Python shell i get the following output: > >>>> >>>> help(input) > Help on built-in function input in module builtins: > > input(...) > input([prompt]) -> string > > I want to know what the significance of "-> string". I have tried > consulting several books but none of them gave me a clear-cut explanation > for this.
Note that the "->" is also valid Python: >>> def f(x: int) -> str: ... return "<{}>".format(x) ... >>> f(42) '<42>' It was originally "invented" here https://www.python.org/dev/peps/pep-3107/#return-values and later morphed into https://docs.python.org/dev/library/typing.html According to that f() should take an integer and return a str. This information can be used by type checkers like http://mypy-lang.org/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor