News for hackers. Stuff that matters.
Re:Please, stop pushing for static typing in Python by dragonwriter on Tuesday February 01, 2022 @06:35PM (#30171322)
> They are ugly.

Don't use type hints.

> They require additional knowledge to implement correct type hints.

Don't use type hints.

> It encourages bikeshedding on features useless to the core language. Manpower is wasted on something the majority of Python developers and applications don't really benefit from.

The majority of Python developers and applications benefit from typing improving the quality fo the ecosystem whether or not they directly use type hints.

> It creates the rift in the language.

Not as much as forking the ecosystem between two separate related languages would. (Which is why support for typing was added, mypy was initially a separate language.)

> The editors and IDEs have become too reliant on type hints, so they changed their linting algorithms to basically require typing.

VSCode’s Python support works fine with or without type hints in user code. Obviously, you get more value with them, but that's because there is more information to work with. And even if you don't use any type hints in your code, you get benefits from hints in libraries/stubs for dependencies.

If you have some other tooling that doesn't work for your untyped code, take it up with the tooling vendor.

> It affects the startup performance.

I wouldn't mind seeing a Python -> Python transpiler that removed type specific code, so that dev-time type hinting is zero-cost in production. This is not a non-issue, but it's also not enough to justify dropping typing support from the language.

Re:Please, stop pushing for static typing in Python by wheelerof4te on Tuesday February 01, 2022 @07:02PM (#30171620)
"VSCode’s Python support works fine with or without type hints in user code. Obviously, you get more value with them, but that's because there is more information to work with."

How can I avoid type hints when my IDE is "smarter" now with them? When they changed it's linter to look for type hints and ignore the rest of the code in functions in order to determine types?

Sure, it is easier for IDE developers to just leverage type hints and ignore the context of the entire script. But, what does that mean? Am I now required to type hint my functions just to make use of my IDE's features? It is certainly implied.

Sure, you can use VS Code without type hints. But that would be like playing Guild Wars 2 without in-game purchases. Possible, but much harder and you would be outplayed by a lot of top ranked players.

Re:Please, stop pushing for static typing in Python by dragonwriter on Tuesday February 01, 2022 @07:24PM (#30171813)
> How can I avoid type hints when my IDE is "smarter" now with them?

Accept that the IDE won't be smarter for the kind of code you are writing.

> When they changed it's linter to look for type hints and ignore the rest of the code in functions in order to determine types?

Oh, so you mean “now that my IDE changed to be dumber without them than it used to be”. Don't use that IDE. Or complain to them to fix it. Or choose a non-default linter, if it supported. (IDEs can be very opinionated about how languages will be used, but to the extent that this conflicts with your preferences, complaining that the language shouldn't support something because the IDE you were using decided to only support that approach is blaming the wrong party.)

> Sure, it is easier for IDE developers to just leverage type hints and ignore the context of the entire script.

Python has lots of available linters, and most of them don't do that (you can't correctly apply type hints of you do, so its a bad idea even with type hints.) If a linter does that, don't use that linter. If an IDE mandates exclusively using a linter that does that, don't use that IDE.

> Am I now required to type hint my functions just to make use of my IDE's features?

I don't know about your IDE. Mine works as well as it ever did (well, better, as it is continually improving) on non-hinted code, and even better than that with with hinted code.