Hacker News new | ask | show | jobs
by dwrodri 1056 days ago
So fun fact, I had discussed this exact approach with a few people when i was debugging this, and in fact this was the first solution I had come up with.

However, the approach in my code generates less bytecode and performed slightly faster, as the chained generator expressions add more overhead. See here: https://godbolt.org/z/nT8a5eMGa

I agree that your approach requires less usage of (what I'd consider) unintuitive syntax, so I should probably add it as an alternative viable solution!

Since if performance is so critical as to worry over something like this, we'd probably both agree that you should probably be wary of choosing Python in the first place.