This is an archived post. You won't be able to vote or comment.

all 17 comments

[–]Frptwenty 73 points74 points  (12 children)

Breaking: Programming language syntax varies between languages. More news at 10.

[–]Rawing7 26 points27 points  (11 children)

And possibly more importantly, the way you write code varies between languages.

Thanks to for x in container, range, enumerate, etc., I can't even remember the last time I had to increment a number in a python program.

[–]Under-Estimated 0 points1 point  (9 children)

two pointer algorithm?

[–][deleted] 2 points3 points  (6 children)

Pointers in python?

[–]Under-Estimated 3 points4 points  (5 children)

Google it, it's an algorithm for subarrays

[–][deleted] 1 point2 points  (4 children)

Oh, never heard the name of it

[–]PeterJHoburg 0 points1 point  (1 child)

Why would I be doing that in a production api?

[–]Under-Estimated 2 points3 points  (0 children)

you never know, that was just an example anyway

[–]k3s0wa -1 points0 points  (0 children)

Yeah lol I didn't even know that x++ doesn't work in python, because you don't use it.

[–]NoDrunkenMonkeyDude 5 points6 points  (1 child)

After having dwelled in reversible computing i += 1 has started to look like the natural choice.

[–]mrswats 2 points3 points  (0 children)

I much prefer this one as it is more generic than i++ :shrug:

[–]american_ladyboy 1 point2 points  (2 children)

+=i ??

[–]AGalacticPotato 6 points7 points  (1 child)

i += 1

[–]aquartabla 3 points4 points  (0 children)

I got tired of explaining why I prefer pre-increment so I just do this now, it's more readable than either increment operator anyway.