News for hackers. Stuff that matters.
Re:Rust – A hard decision pays off by rjh29 on Wednesday August 24, 2022 @05:15PM (#32585878)
Having recently used it, my impression is Python's type system is pretty damn powerful. It might not be as crazy as TypeScript, but it can handle recursive types, dictionaries with a fixed set of keys, functions, union types and generics. Types can be re-used or exported. There are generic types for things like 'Iterable'.

If a package does not supply its own types (increasingly rare now), you can generate stubs and put them in typings/$package.

It's picked up a bunch of bugs for me already. And if runtime performance is not a priority, I'd rather write Python than Go or Rust any day. It's more fun and more expressive.

Re:Rust – A hard decision pays off by rowanG077 on Thursday August 25, 2022 @06:43AM (#32591940)
Does it support annotating numpy arrays with their dimensions yet? Last time I checked I was incredibly surprised the status quo was basically all numpy arrays are np.ndarray.
Re:Rust – A hard decision pays off by rjh29 on Thursday August 25, 2022 @07:17AM (#32592170)
I think so:

https://numpy.org/devdocs/reference/typing.html

Which is cool, even strongly typed languages don't usually support that.

Re:Rust – A hard decision pays off by rowanG077 on Thursday August 25, 2022 @08:10AM (#32592620)
There is no example there that show that. I mean something like np.ndarray[1024, 1024, 1024, type=Int] which would mean a 3D array where each dimensions has 1024 elements. Basically all statically typed language support it. Even in C you can do it.