
On Tue, Nov 30, 2021 at 4:48 PM Oscar Benjamin <oscar.j.benjamin@gmail.com> wrote:
On Tue, 30 Nov 2021 at 23:37, Guido van Rossum <guido@python.org> wrote:
We should definitely push back on zealous new converts to typing who
insist that everything should be annotated. But we should also recognize that even in their current, far from perfect state, type annotations can provide a lot of value, when used right. (Have you run into VS Code yet? It gets tremendous value from typing stubs, in the form of improved auto-complete and hover-doc functionality.)
I might be misunderstanding but if "hover-doc" is the same as "mouse-over" then it apparently needs many gigabytes of memory and a lot of CPU time when you put the mouse over a sympy function that you are using in your code. It has been suggested that SymPy should fix this by adding hints like Any but I don't see the point of that: SymPy has plenty of bugs but this particular bug is in VS Code.
(Yes, I meant mouse-over. I had a senior moment. :-) I cannot help you much here, there's a tracker and generally speaking the team does pay attention to tracker issues, so I recommend starting a discussion there. Feel free to CC me on the issue if you decide to create one.
I can see the potential value that type hints can bring for an editor like VS Code but is the editor also pushing an agenda that all code should be *explicitly* typed? Does VS Code pressurise people into using type hints in their own code? I presume it does because I see the effect in my students (although I might be misattributing this to VS Code rather than something else).
There are two modes in VS Code, a lenient and a strict mode. The strict mode does insist on typing, but you have to opt in to it first. Once you've opted in, it does indeed encourage you to type everything -- but that's pretty much the meaning of strict type checking (mypy has a --strict flag that also requires this). That said, your students probably copied some configuration that turns on strict mode from someone else who is thereby pushing this agenda unwittingly. Sadly most people forget where they got their initial configuration (I know I forget it as soon as it works :-). And the strict mode also provides useful error messages in certain cases. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...>