<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 18, 2017 at 11:49 PM, Eric V. Smith <span dir="ltr"><<a href="mailto:eric@trueblade.com" target="_blank">eric@trueblade.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I also don't think it's surprising that you can put misleading information (including non-types) in type annotations. All of the documentation and discussions are quite clear that type information is ignored at runtime.<br></blockquote><div><br></div><div>Sure -- but that's documentation of type annotations -- someone uninterested in typing, or completely unaware of it, will not be reading those docs.</div><div>Â </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Data Classes is also not the first use of type annotations in the stdlib:<br>
<a href="https://docs.python.org/3/library/typing.html#typing.NamedTuple" rel="noreferrer" target="_blank">https://docs.python.org/3/libr<wbr>ary/typing.html#typing.NamedTu<wbr>ple</a></blockquote><div><br></div><div>That's in the typing package, yes? <font face="monospace, monospace">collections.namedtuple</font> is unchanged. So yes, obviously the entire typing package is about typing. This is something that has nothing to do with typing, but does use the typing syntax. It really is different.</div><div><br></div><div>I haven't started teaching typing to newbies yet -- but I imagine I will have to some day -- and when I do, it will be in the context of: here is an optional feature that you can use along with a static type checker. And I can make it clear that the annotations only apply to the static type checker, and not run-time behavior.</div><div><br></div><div>But using type annotations for something other than providing information to a static type checker, in an stdlib module, changes that introduction. And people don't read all the docs -- they read to the first example of how to use it, and away they go. And if that example is something like:</div><div><br></div><div>@dataclass</div><div>class C:</div><div>  a: int</div><div>  b: float = 0.0</div><div><br></div><div>There WILL be confusion.</div><div><br></div><div>Paul Moore wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">Also, the fact that no-one raised this issue during the whole time the<br></span><span style="font-size:12.8px">PEP was being discussed (at least as far as I recollect) and that<br></span><span style="font-size:12.8px">Guido (who of all of us should be most aware of what is and isn't<br></span><span style="font-size:12.8px">acceptable use of annotations in the stdlib) approved the PEP,<br></span><span style="font-size:12.8px">suggests to me that this isn't that big a deal.</span></blockquote><div><br></div><div>That suggests to me that the people involved in discussing the PEP may not be representative of the bulk of Python users. There are a number of us that are uncomfortable with static typing in general, and the python-dev community has been criticised for doing too much, moving too fast, and complicating the language unnecessarily.</div><div><br></div><div>The PEP's been accepted, so let's move forward, but please be aware of these issues with the documentation and examples.</div><div><br></div><div>I'll try to contribute to that discussion as well.</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R       (206) 526-6959  voice<br>7600 Sand Point Way NE   (206) 526-6329  fax<br>Seattle, WA  98115     (206) 526-6317  main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>