Hacker News new | ask | show | jobs
by jhbadger 116 days ago
Have you never tried to paste python code from the internet into an editor? At least half the time the indentation is screwed up and I have to go in and figure out manually where to put the spaces in. Indentation gets screwed up by pasting in other languages too, but with those I can generally tell the editor to reindent and it can because the information is included in the source code.
2 comments

Get a better editor! Yes if your tools suck, things suck. So get better tools.
I've tried them all - vim, emacs, vscode, etc. They all fail in this regard not because of themselves but because significant whitespace is a terrible idea which nearly every programming language avoids.
the solution is the same - you tell the editor to paste with an indentation adjustment