Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Do you deliberately "misindent" the code or is it mostly because it's hard to reindent and then back the change out? If the latter, that's obviously a different use case and one can use syntax tricks to achieve the same with Python if you don't want to have your editor help with that for whatever reason.


I also sometimes misindent some temporary debug print statements. However, indenting them right is just a matter of typing == in vim, while the cursor is somewhere on the misindented line.

Moreover, the ] modifier before p or P (paste below or above current line) adjusts the paste to the indentation of that current line. It takes next to no effort to copy and paste some code to the correct indentation.

Backing changes out nowadays is done with "git checkout --patch".


Getting indentation right with editor support is trivial in Python too (in Emacs, TAB does what you describe anywhere on the line, and when there are multiple valid options, it cycles through those).

Pasting blocks into right indentation or reindenting entire blocks too. So I am glad you agree it's simple to do any of these even with significant whitespace ;)

I wouldn't know about other editors, but I'd be surprised if it's not so in every one of them.

Where indentation really matters for temp debug statements — you want to enter a block unconditionally or skip it unconditionally — there are other syntactic tricks like add `True or`, `False and`, return, continue, break, semicolon, etc. But these are all temporary examples you are giving, and this only matters if editor is not supporting you.

And that's my point: these are trivialities and I can't stop being perplexed that people get so fussy about it.

I am not sure how git plays into this? It works exactly the same for Python, it's not like Python is bf with space as the control character.


Deliberately, both in order to mark it in a special way to stand out clearly, as well as to avoid having to add indentation for such a code where it is unnecessary and not helpful. That line of code will soon be deleted anyways, so it does not matter much if other people dislike it.


Can you share an example where you non-temporarily add braces around a code block but then keep the indentation the same level as before the block? What do your collaborators think of it?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: