News for hackers. Stuff that matters.
Re:NumPy 2.0.0 by mFixman on Monday June 17, 2024 @06:01AM (#40703988)
Most of the bugs I got on numpy programs came from a variable with a different ndims as expected being broadcast implicitly.

Implicit type casting is considered a mistake in most programming languages; if I were to redesign numpy from scratch I would make all broadcasting explicit.

My solution to these problems is asserting an array's shape often. Does anybody know is there's a tool like mypy or valgrind, but that checks mismatched array shapes rather than types or memory leaks?

Re:NumPy 2.0.0 by cozzyd on Monday June 17, 2024 @02:12PM (#40709041)
numpy's API was carefully designed to match matlab, where most of its early users came from.
Re:NumPy 2.0.0 by mFixman on Monday June 17, 2024 @02:18PM (#40709097)
Then we are lucky they didn't decide to start their arrays at 1 :-)
Re:NumPy 2.0.0 by cozzyd on Monday June 17, 2024 @06:24PM (#40711833)
indeed...