When I started working in python, I got lazy with “single assignment”, and I need to nudge myself about it. You should strive to never reassign or update a variable outside of true iterative calculations in loops. Having all the intermediate calculations still available is helpful in the debugger, and it avoids problems where you move a block of code and it silently uses a version of the variable that wasn’t what it originally had. In C/C++, making almost every variable const at initialization is good practice. I wish it was the default, and mutable was a keyword.
Replying to @ID_AA_Carmack
In JS, we now have `const` and `let`, which at least during initialization helps to understand their usage. Everything used to be `var`, luckily these days are in the past.

Oct 29, 2025 · 7:37 PM UTC

1
14
Const in JavaScript is not as const as one would expect it to be:
1
1
Would you expect `const player = new Player()` to have non-modifiable properties? So you couldn't do something like: `player.hp -= 10`? Use `Object.freeze`. `const` - means you can't modify a value or reference, nothing to do with complex objects or arrays.
2
2