Live data from Hacker News

No Semicolons Needed

terts.dev

91–92 of 92 posts

Re: No Semicolons Needed

#91
post #90
post #89

Earlier quoted context omitted.

The problem is that if you copy random code from the internet it cannot figure out the right indentation level - whitespace has meaning in python. What IDE can automagically handle this?

Do you mean "figure out that I'm pasting at level 3, so all pasted code should have +3 levels of indents" like plugins like this one do? https://marketplace.visualstudio.com/items?itemName=hyesun.p... (Sublime has the same, so does vim see comment above, so do many real IDEs) Or do you mean something different?

This is nice, but it's not always the case that +3 indent is the right solution (e.g. if I'm copying already indented code it may be over indented).

It's basically a non problem in most other languages, and a IDE formatter hook will always clean up the code and organize it correctly in a way that you cannot get in Python.

Re: No Semicolons Needed

#92
post #91
post #90

Earlier quoted context omitted.

Do you mean "figure out that I'm pasting at level 3, so all pasted code should have +3 levels of indents" like plugins like this one do? https://marketplace.visualstudio.com/items?itemName=hyesun.p... (Sublime has the same, so does vim see comment above, so do many real IDEs) Or do you mean something different?

This is nice, but it's not always the case that +3 indent is the right solution (e.g. if I'm copying already indented code it may be over indented). It's basically a non problem in most other languages, and a IDE formatter hook will always clean up the code and organize it correctly in a way that you cannot get in Python.

Have you not used any of such IDEs/plugins? It's not X+3 indent, it's "starting at +3", so if you have lines with +10 indent (overindented) copied and paste them at +3 indent, they all get indents cut by 7 levels and end up at the same +3 level as expected.
Post reply on HN