3 ms·
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
by rao-v 7mo ago
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?
- eviks 7mo agoDo 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.py-paste-indent 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?
- rao-v 7mo agoThis 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.
- eviks 7mo agoHave 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.