As a non-Go/Python user, those two snippets look practically identical to me, although I understand just enough to have written the same comments. Unfortunately, the comments don't tell me what I'd really like to know about the code if I ran across it when debugging:
* What are b, j, and k?
* What's so significant about even numbers - or is 2 a magic number that could just as easily have been 3?
* What can I assume about results? Can it be empty, null, 10 elements, 10 million elements?
With proper naming and a good, brief chunk-level comment, I could tell at a glance whether this chunk is likely to be hosting my bug or not. 5 lines vs. 8 lines don't play much into it.
Actually, this really isn't what I think of when I hear "boilerplate". I think of, for example, the adapter pattern, or having to build up a finicky set of states every time some common task is done.
* What are b, j, and k?
* What's so significant about even numbers - or is 2 a magic number that could just as easily have been 3?
* What can I assume about results? Can it be empty, null, 10 elements, 10 million elements?
With proper naming and a good, brief chunk-level comment, I could tell at a glance whether this chunk is likely to be hosting my bug or not. 5 lines vs. 8 lines don't play much into it.
Actually, this really isn't what I think of when I hear "boilerplate". I think of, for example, the adapter pattern, or having to build up a finicky set of states every time some common task is done.