8 ms·
Code can absolutely be incorrectly indented in python and to make matters worse it changes the functionality of the code when it is.
by kimmeld 4y ago
Code can absolutely be incorrectly indented in python and to make matters worse it changes the functionality of the code when it is.
- thaumasiotes 4y agoCode can be indented in a way you didn't mean for it to be. But it cannot be incorrectly indented in the sense I just described, because the indentation changes the functionality of the code. The indentation can never mislead you about the structure of the code.
- Izkata 4y agoI've seen one case where it has, where the outdent at the end of a nested loop/loop/if was wrong: it was only 3 spaces instead of matching the 4 indent, so it looked right at a glance but wasn't. Needed to use pdb to step through it and see it do the wrong thing before that stuck out.