[docs] [issue32769] Add 'annotations' to the glossary

Guido van Rossum report at bugs.python.org
Mon May 14 15:45:13 EDT 2018

Guido van Rossum <guido at python.org> added the comment:

Before we backport this to 3.7 and 3.6, let's iterate on the wording a bit.

I don't think the distinction between annotations and type hints is that annotations are materialized at runtime while type hints aren't. I think syntactically they are the same, but annotations are a slightly more general concept because they may be used for other purposes than to indicate the type of a variable (or argument, attribute etc.).

So IMO in

  def f():
      x: int

'int' is both an annotation and a type hint, OTOH in

  x: 'spam eggs ham'

we have an annotation that is not a type hint.


Python tracker <report at bugs.python.org>

More information about the docs mailing list