
On Tue, 30 Nov 2021 at 09:23, Paul Moore <p.f.moore@gmail.com> wrote:
On Tue, 30 Nov 2021 at 02:52, Steve Dower <steve.dower@python.org> wrote:
THAT'S the kind of thing that also has been happening with typing, and why some of us feel the need to publicly re-state things that are all agreed upon within this group, but are struggling to be heard over the public discourse on the topics. And this kind of reiteration is easier when our official documents (PEPs, etc.) state it explicitly.
This is very definitely the case. There's a subtle (maybe not so subtle, actually) and increasing pressure on projects to add typing. Often with little or no justification beyond "you should", as if having typing is a sort of "obvious best practice". Sometimes "because it will make it easier for your users who use typing" is given as a justification, but while that's fair, it's also a disturbing gradual pressure for typing to extend everywhere, manifesting by making it feel like not adding typing is somehow "not caring about your users".
I suspect that a big source of this is editors that use typing for autocompletion etc. Speaking as a vim user this is something that has passed me by except that I have students who I see adding type hints even though I deliberately haven't taught them anything about type hints. I can only presume that some editor is doing this for them or telling them that they need to do this (students often can't tell the difference between editor warnings and actual errors). Others have mentioned the pressure on libraries to adopt typing and I've certainly noticed this with SymPy. I think type hints could be good for SymPy for internal use but it seems that a lot of users want it for external reasons that I don't always understand but that also seems to come partly from editors as well. Some people apparently want to add type hints that look completely useless to me like def f() -> Union[MyClass, Any] As I understand it this does not give any meaningful information to a type checker but it apparently makes vscode work better: https://github.com/sympy/sympy/pull/22180#discussion_r718917577 Here in SymPy you can see a suggestion that type hints are needed because otherwise vscode is slow and uses 4GB of memory just to load documentation for SymPy functions: https://github.com/sympy/sympy/issues/17945#issuecomment-928798977 Not to do with editors but also indicative is this PR whose title implies that SymPy is "incompatible" with PEP 561 (a PEP that I had never heard of before seeing the PR): https://github.com/sympy/sympy/pull/22337 There are other open "issues" like this for SymPy where the presumption is that not having type hints is now to be considered a deficiency of the library regardless of whether the hints have any benefit for internal use. I don't object to adding the hints but it's a huge amount of work that someone would have to do and I don't want to add useless/inaccurate hints temporarily (as some have suggested to do). -- Oscar