Programming "with the grain"

https://ishan.page/blog/2023-07-09-programming-with-the-grain

27 points · 4 comments · view on lemmy.world

4 Comments

noneabove1182@sh.itjust.works · 7 pts · 3y (3 replies)

Honestly an interesting thought and worth keeping in mind, I would love to see a lot more examples and more timing, especially for the pythonic ones, are they more efficient or just more python like?

ishanpage@programming.dev · 3 pts · 3y (2 replies)

OTOH, the more pythonic one will probably perform worse, but I'm not familiar enough with Python internals to make that claim without benchmarks.

I'll try it out and add the data in the article

Hazzard@lemm.ee · 4 pts · 3y (1 reply)

Eh, the python one will probably perform better, because sum is probably written in native C under the hood.

jadero@programming.dev · 3 pts · 3y

I've yet to find a language where "doing it yourself" has higher performance than calling the built-in or library function. There are edge cases, but rarely enough to be bothered about.