News for hackers. Stuff that matters.
Re:What's New in Python 3.11? by klyrs on Monday June 27, 2022 @01:03AM (#31890757)
As somebody who's comfortable with Python and C++... ugh. Types are frankly kinda silly. They don't do anything, the language doesn't even ship a blessed typechecker, they don't speed up your code, they don't make it safe, they just add useless notation that some mutually-incompatible third-party tools grok. And the mutually-incompatible thing is what really rubs me wrong. They didn't sit down and define a bombproof type system; they just added an optional notation and let the community figure it out (like packaging). Years later, and the community has not figured it out (like packaging).

Compared to C++, where you can do incredible zero-overhead magic with the type system; for example duck-typing, once The Way, is now an absolute nightmare in Python's type system. Python typing is little but baggage and warts unless you've drunk the cool-aid and then you're horrified that people like me haven't.

(and, all that said, I'm quite excited about py3.11, it's great on performance and ergonomics)

Re:What's New in Python 3.11? by Daishiman on Monday June 27, 2022 @01:37AM (#31890925)
I don't use typing with type checkers; I use it to remind readers of my code what types my functions take whenever that's not immediately obvious.

The history of Python means that coders make functions whose return is usually quite clear, but when it's not, I'm really glad I have typing.

Also, some libraries like Pydantic make use of types in a very clever and productive way.

Re:What's New in Python 3.11? by orf on Monday June 27, 2022 @04:29AM (#31891944)
They are not useless at all. Because they are introspectable new types of extremely ergonomic libraries have sprung up (FastAPI, Pydantic), as well as the developer experience improving.
Re:What's New in Python 3.11? by pid-1 on Monday June 27, 2022 @01:45PM (#31898026)
Check Pydantic out.

Really cool for parts of your code in which runtime type enforcing is important (eg. external interfaces)

Re:What's New in Python 3.11? by klyrs on Wednesday June 29, 2022 @01:46PM (#31923433)
Three responses now, recommending the same third party stuff, which I already acknowledged the existence of. Kinda missing the point of what I had to say, isn't it?