Hacker News new | ask | show | jobs
by Epokhe 1345 days ago
Yeah, makes sense that it's popular. I just thought you were making a joke by creating a similar looking issue with a different underlying reason.

In Go example the issue happens because item variable is per-loop, in your python example the issue is not related to loops at all, it's just because functions capture the value of global variables at execution time.

And the cherry on top is that the solution is also similar looking(i=i), but working with a different mechanic underneath(default argument assignment).

Anyway, this was my perspective that led me to interpret this as satire. A bit disappointed haha