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

PEP-8 (more than 15 years old) recommend spaces, so unless you are deliberately looking for a fight, the question is settled.

Autoindent is a solution to a problem that doesn't exist in Python in the first place. Having two independent representations for blocks, one for human readers (indent) and one for compilers (braces), leads to nasty bugs when they get out of sync. Autoindent is a tool to keep them in sync. In Python there is a single representation, so nothing can get out of sync.



But the tooling for editing the code has no support for indenting blocks as trivially as adding braces. Sure, you just run clang-format or such on the block/file, and get all the visual stuff sorted out.


What editor does not support indenting a block? In most editors I know you select the block and hit tab, or shift-tab to outdent.


The difference is that I can add braces in the middle of multiple lines, just need to get my changes to match up, and then I can tell it to reformat the changed section/the whole file. For block indenting, I have to select each block I want to operate on before issuing the block indent command. Braces let me skip the selecting, requiring the same cursor movement but allowing batch insertion of selection begin/end markers, in a sense.


Or reformat the entire file according to global formatting styles, like IntelliJ.




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

Search: