4 ms·
I don't trust anyone who uses camelCase to write Python. Or, unnecessary while loops. But, sometimes you can improve built in functions. I found that using a c
by otteromkram 2y ago
I don't trust anyone who uses camelCase to write Python. Or, unnecessary while loops.
But, sometimes you can improve built in functions. I found that using a custom (but simple) string-to-int function in golang is a bit quicker than strconv.formatInt() for decimal numbers.
So, there's that.
Python isn't really supposed to be geared towards performance. I like the language, but only see articles like this as resume fodder.
- lacksconfidence 2y ago> but only see articles like this as resume fodder. Not super important, but i think it's worth calling out. Some of us program because it's fun. We dig into problems like this because it scratches an itch. We share in the hopes of interacting with like-minded individuals. Not everything is about resumes.
- mananaysiempre 2y agoPersonally I tend to discount the possibility of such motivations for a text once that text is interrupted in the middle to sell me something (which a Substack form counts as).
- sgarland 2y agoIndeed. Some of us do it because we stubbornly want to see just how fast we can make a “slow” language go.
- hoten 2y agoWow, very unfair. It should not be surprising that people writing Python might actually care about performance, even if it isn't so important that they must write their software in assembly. The code wasn't the authors, and what's more it's just an example to talk about the bytecode. Everyone knows `min(some_list)` is faster and more Pythonic. This is a very interesting article and probably exposed a few people to a few interesting Python internals.
- otteromkram 2y agoI was just referring to the sample code at the top. I should have clarified that and I apologize for the lack of clarity. But, I would like to see the author use a for loop. I'm not why anyone would use a while loop of they know the constraints.