(original) (raw)

On 5 September 2016 at 20:15, Guido van Rossum <guido@python.org> wrote:
There are actually at least two separate cases: if x is a local
variable, the intention of \`x: \` is quite different from when x
occurs in a class.

If I understand you correctly this also matches my mental model.
In local scope

x: ann = value

acts like a filter allowing only something compatible to be assigned
at this point (and/or casting to a more precise type).
While in class or module it is a part of an "API specification" for that class/module.

I am at a loss how to modify the PEP to avoid this misunderstanding,
since it appears it is entirely in the reader's mind. The PEP is not a
tutorial but a spec for the implementation, ...

I was thinking about changing terminology to name annotations, but that will
not solve problem. The PEP mentions a separate document (guidelines) that will be published.
I think a real solution will be to make a separate PEP that will explain in details
what is preferred meaning of types and what people and machines could do with types.

Is anyone interested in going in this direction? I would like to especially invite Mark,
you have a lot of experience with types inference that would be very helpful
(also it seems to me that you are concerned about this).

--
Ivan