frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

DumPy: NumPy except it's OK if you're dum

https://dynomight.net/dumpy/
71•RebelPotato•5h ago

Comments

the__alchemist•1h ago
Clear articulation of why Numpy syntax is provincial and difficult to learn. Perhaps the clearest part of it clicks when the author compares the triple-nested loop to the numpy-function approach. The former is IMO (And the author thinks so) much easier to understand, and more universal.
Gimpei•1h ago
I’ve known some people who didn’t want to learn the syntax of numpy and did it all in loops, and the code was not easy to read. It was harder to read. The fundamental issue is that operations on high dimensional arrays are very difficult to reason about. Numpy can probably be improved, but I don’t think loops are the answer.
okigan•1h ago
What’s a better syntax then?
tikhonj•1h ago
The real question—to which I have absolutely no answer—is not about syntax, it's about concepts: what is a better way to think about higher-dimensional arrays rather than loops and indices? I'm convinced that something better exists and, if it existed, encoding it in a sufficiently expressive (ie probably not-Python) language would give us the corresponding syntax, but trying to come up with a better syntax without a better conceptual model won't get us very far.

Then again, maybe even that is wrong! "Notation as a tool for thought" and all that. Maybe "dimension-munging" in APL really is the best way to do these things, once you really understand it.

CamperBob2•37m ago
English. "Write me a Python function or program that does X, Y, and Z on U and V using W." That will be the inevitable outcome of current trends, where relatively-primitive AI tools are used to write slightly more sophisticated code than would otherwise be written, which in turn is used to create slightly less-primitive AI tools.

For example, I just cut-and-pasted the author's own cri de coeur into Claude: https://claude.ai/share/1d750315-bffa-434b-a7e8-fb4d739ac89a Presumably at least one of the vectorized versions it replied with will work, although none is identical to the author's version.

When this cycle ends, high-level programs and functions will be as incomprehensible to most mainstream developers as assembly is today. Today's specs are tomorrow's programs.

Not a bad thing, really. And overdue, as the article makes all too clear. But the transition will be a dizzying one, with plenty of collateral disruption along the way.

willseth•1h ago
why_not_both.gif
breppp•1h ago
I've read the article and it didn't seem to me the author is suggesting loops
dahart•36m ago
The point here is not that it’s loops per se, the point is that the indexing is explicit. It seems like a big win to me. The article’s ~10 non-trivial examples all make the code easier to read, and more importantly, to understand exactly what the code is doing. It is true that some operations are difficult to reason about, that’s where explicit indexing really helps. The article resonates with me because I do want to learn numpy syntax, I’ve written hundreds of programs with nympy, spent countless hours doing battle with it, and I feel like I’m no better off now than someone who’s brand new to it. The indexing is constantly confounding, nothing ever just works. Anytime you see “None” and “axis=“ inside an operation, it’s a tell: bound to be difficult to comprehend. I’m always having to guess how to use some combination of reshape, dstack, hstack, transpose, and five other shape changers I’m forgetting, just to get something to work and it’s difficult to read and understand later. It feels like there is no debugging, only rewriting. I keep reading the manual for einsum over again and I’ve used it, but I can’t explain how, why, or when to use it, it seems like this thing you have to resort to because no other indexing seems to work. The ability to do straightforward explicit non-clever indexing as if you were writing loops seems like a pretty big step forward.
okigan•1h ago
Fantastic article.

I don’t use numpy often enough - but this explains the many WTF moments why it’s so annoying to get numpy pieces to work together.

crescit_eundo•1h ago
Dupe. Posted a number of times the past day and a half:

https://news.ycombinator.com/item?id=44072775

https://news.ycombinator.com/item?id=44063553

https://news.ycombinator.com/item?id=44078019

https://news.ycombinator.com/item?id=44063490

homarp•14m ago
but only https://news.ycombinator.com/item?id=44063490 has 'some' comments. so this current discussion is better
kevmo314•1h ago
I’m not convinced by the loops proposal. TensorFlow had this kind of lazy evaluation (except I guess TF was the worst of both worlds) and it makes debugging very difficult to the point that I believe it’s the main reason PyTorch won out. Such systems are great if they work perfectly but they never do.

NumPy definitely has some rough edges, I sympathize with the frustrations for sure.

mpascale00•56m ago
In the way that `ggplot2` tries to abstract those common "high dimensional" graphing components into an intuitive grammar, such that you may in many places be able to guess the sequence of commands correctly, I would love to see an equivalent ergonomic notation. This gets part way there by acknowledging the problem.

Mathematical operations aren't obliged to respect the Zen of Python, but I like the thought that we could make it so that most have an obvious expression.

shiandow•27m ago
That is amazing. My main doubt would be how future proof this is. Does it wrap numpy? Or something equivalent? Does it require continuous development to keep up?

Also I both understand the need for declaring the matrices up front and think it's a bit of a shame that it is not seamless.

Here are some (ill-advised?) alternatives:

    X, Y, Z = dp.Slots()
    
    with dp.Slot() as X:
        ...
    
    import dp.Slot as new
    X = new['i','j'] = ...

    X = dp['i','j'] = ...
darepublic•10m ago
Need transpilation rather than relying on this library being present. I like the idea alot though
dynm•4m ago
(author here) This wraps JAX and JAX's version of NumPy. It would surely require some development to keep up, although it's quite short and simple (only 700 lines), so I don't think it would be a big burden. That said, I should be clear that my goal here is just to show that this is possible/easy, and possibly inspire existing array packages to consider adding this kind of syntax.

I like your alternatives! I agree that having to write

  X = dp.Slot()
before assigning to X is unfortunate. I settled on the current syntax mostly just because I thought it was the choice that made it most "obvious" what was happening under the hood. If you really want to, you could use the walrus operator and write

  (X := dp.Slot())['i','j'] = ...
but this cure seems worse than the disease...

Actually, doing something like

  X = new['i','j'] = ...
could simplify the implementation. Currently, a Slot has to act both like an Array and a Slot, which is slightly awkward. If new is a special object, it could just return an Array, which would be a bit nicer.

New Study Confirms That Cancer Cells Ferment Glutamine [video]

https://www.youtube.com/watch?v=KjdAtauO2cA
2•teleforce•2m ago•0 comments

What keeps Wandering Thoughts more or less free of comment spam (2025 edition)

https://utcc.utoronto.ca/~cks/space/blog/web/CommentSpamPrecautionsII
1•zdw•2m ago•0 comments

TV Review: Adolescence – Netflix's latest liberal mind rot

https://thecommunists.org/2025/05/23/news/culture/tv-review-adolescence-netflix/
1•cempaka•4m ago•0 comments

The Dangers of Browsing AI Agents

https://arxiv.org/abs/2505.13076
1•wslh•4m ago•0 comments

MCP is not REST API

https://leehanchung.github.io/blogs/2025/05/17/mcp-is-not-rest-api/
1•Arindam1729•4m ago•0 comments

Medieval Fogge: In Defence of the Middle Ages

https://www.historytoday.com/archive/making-history/medieval-fogge-defence-middle-ages
1•prismatic•5m ago•0 comments

Show HN: AI Prisoners Dilemma

https://agents-dilemma.fly.dev/
1•gcasselman•6m ago•0 comments

Native Frame Rate Playback (2023)

https://netflixtechblog.com/native-frame-rate-playback-6c87836a948
1•js2•7m ago•0 comments

Apple Better Off Taking 25% Tariff Hit Than Move iPhone Production to US

https://www.macrumors.com/2025/05/23/apple-better-off-taking-tariff-hit/
1•mfiguiere•7m ago•0 comments

The Decline of Usability: Revisited (2023)

https://datagubbe.se/usab2/
1•tosh•10m ago•0 comments

A hawk learned to use traffic signals to hunt more successfully

https://www.frontiersin.org/news/2025/05/23/street-smarts-hawk-use-traffic-signals-hunting
1•geox•12m ago•0 comments

Show HN: F2 – Cross-Platform CLI Batch Renaming Tool

https://github.com/ayoisaiah/f2
1•ayoisaiah•14m ago•1 comments

Anthropic's new AI model deceives and blackmails to avoid being shutdown

https://www.axios.com/2025/05/23/anthropic-ai-deception-risk
2•ryan_j_naughton•15m ago•0 comments

"I scratched my own itch" isn't good enough

https://longform.asmartbear.com/scratched-my-own-itch/
1•gregsadetsky•18m ago•0 comments

NoChat4U: An open source macOS app to appear offline in League of Legends

https://github.com/miguel-mpm/NoChat4U
1•miguelpm97•19m ago•0 comments

Systems-mcp: generate systems models via LLM

https://lethain.com/systems-mcp/
1•tosh•19m ago•0 comments

Material Design 3

https://m3.material.io
1•tosh•26m ago•0 comments

3,400-Year-Old Ancient Egypt's Mechanical Dog That Barks and Moves

https://www.utubepublisher.in/2025/03/3400-year-old-mechanical-dog-from-ancient-egypt.html
2•pqtyw•27m ago•0 comments

An Ex-Tesla Engineer Is Turning EVs into Affordable Family Cars

https://www.wsj.com/business/autos/an-ex-tesla-engineer-is-turning-evs-into-affordable-family-cars-836c565d
2•bookofjoe•28m ago•2 comments

Should Portland Ban Backyard Beekeeping?

https://www.wweek.com/news/2025/05/07/should-portland-ban-backyard-beekeeping/
1•yojo•29m ago•1 comments

Monte Carlo simulations are not attractive

https://old.reddit.com/r/badeconomics/comments/1kgbe2t/monte_carlo_simulations_are_not_attractive/
1•wslh•31m ago•0 comments

Truck platooning could ease driver shortages, save fuel, boost safety

https://spectrum.ieee.org/truck-platooning-ohio-indiana
1•Brajeshwar•32m ago•0 comments

There is unexpected chemistry going on in lithium deposits

https://www.chemistryworld.com/news/there-is-unexpected-chemistry-going-on-in-lithium-deposits/4021558.article
3•Brajeshwar•32m ago•0 comments

Oracle to buy $40B of Nvidia chips for OpenAI's new US data centre

https://www.ft.com/content/a9cd130f-f6bf-4750-98cc-19d87394e657
3•Brajeshwar•32m ago•1 comments

Auto-generating pull request documentation with Claude Code and GitHub Actions

https://solmaz.io/log/2025/05/24/claude-code-pr-autodoc-action/
2•hosolmaz•33m ago•0 comments

Novel Accidentally Leaves AI Prompt Requesting to Copy Other Writer's Style

https://futurism.com/fantasy-novel-ai-prompt-copy-style
4•ryan_j_naughton•34m ago•0 comments

CodeIgniter Framework Version 3 – Vendor Packages Build

https://github.com/nguyenanhung/codeigniter-framework
1•nguyenanhung•38m ago•0 comments

Crypto State of the Union

https://www.milkenreview.org/articles/crypto-state-of-the-union
3•wslh•39m ago•0 comments

Same Stats, Different Graphs

https://www.research.autodesk.com/publications/same-stats-different-graphs/
1•Tomte•40m ago•0 comments

Impossibly Hungry Judges (2017)

http://daniellakens.blogspot.com/2017/07/impossibly-hungry-judges.html
1•Tomte•41m ago•0 comments