What means "->"?

Jerry Hill malaclypse2 at gmail.com
Tue Apr 28 20:03:52 CEST 2015


On Tue, Apr 28, 2015 at 1:18 PM,  <stehlampen at arcor.de> wrote:
> in the Python Language Specification, I've found the delimiter -> (cf.
> https://docs.python.org/3/reference/lexical_analysis.html#delimiters, last
> entry in the table´s second line). Could you please describe the effects of
> this delimiter? I read nothing about -> by now. In addition, help("->")
> didn´t work.

It's part of the syntax for function annotations.

See here in the reference manual:
https://docs.python.org/3/reference/compound_stmts.html#index-23
and/or refer to PEP 3107 for more background:
https://www.python.org/dev/peps/pep-3107/

If you're interested, PEP 484
(https://www.python.org/dev/peps/pep-0484/) is attempting to chart out
the future uses of function annotation for doing type checking in
external tools (keep in mind that PEP 484 isn't final yet, nor has it
been accepted, my impression is that it's still a work in progress).

-- 
Jerry



More information about the Python-list mailing list