<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 22, 2015 at 3:35 PM, Guido van Rossum <span dir="ltr"><<a href="mailto:guido@python.org" target="_blank">guido@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>The only situation where there may be a desire to change something (the minimal thing being to add a "# type: OFF" comment at the top of a module) is when a library that uses annotations for non-type-hinting purposes is used by an application (or another library) that wants to use type hints, and the user who is running the type checker cannot live with the noise output spewed by the type checker for that library.<br><br></div><div>Even there, the problem could also be solved by having a way to configure the type checker to ignore annotations in certain packages (or to only check code in specific directories).<br></div></blockquote><div><br></div><div>Having library authors change their code because type hinting was introduced would be unacceptable.<br><br></div><div>The burden must all on whomever wants to benefit from type checking.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div></div><span class=""><div>  <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div>Since type hints already depend on the 'typing' module anyway, what exactly would be wrong with the type checker defaulting off unless it is imported?</div></div></blockquote><div><br></div></span><div>I've considered that, but I find it limiting. It is quite likely that a module can be fully annotated with type hints without ever needing to reference the typing module. For example, all argument types may be simple built-in types (strings and numbers) or user-defined classes. I think it would be unexpected if type hints that were present in a module would be ignored by the type checker unless the typing module was imported. (Also, perhaps ironically, most linters will complain about modules that are imported but not used. :-)</div></blockquote></div><br></div><div class="gmail_extra">"import typing" is a nice and easy compromise, very much in the pythonic way, in my opinion.<br><br></div><div class="gmail_extra">If you want your module type checked: import typing. It will not be checked otherwise.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">It's simple, backwards compatible, very little effort for those wanting to jump into PEP484, and zero pain for those who don't.<br><br></div><div class="gmail_extra">Cheers,<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature"><span style="color:rgb(0,102,0)">Juancarlo </span><b style="color:rgb(0,102,0)">Añez</b></div>
</div></div>