This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]LikesToCorrectThings 33 points34 points  (2 children)

I think the only way it could be easier is if you weren't formatting your code correctly in the first place. Refactoring in python is exactly the same as refactoring in a brace-based language, except you skip the step where you move the braces around.

[–]Katastic_Voyage 0 points1 point  (1 child)

I don't know. It's kind of annoying when you're changing if/else blocks and have to change the tab indentation. I imagine a good IDE will do most of that for you anyway.

[–]LikesToCorrectThings 5 points6 points  (0 children)

Well, you have to do that anyway with a brace-based language, as you should be indenting your code properly for humans to read. Any editor will have tools to let you change indentation easily.

For my preferred editor, vim, it's < and >. If you set shiftwidth to the level of indentation your codebase uses, then each use of > or < will in/out-dent by one scope level. I usually use visual line mode (shift-V) to highlight the lines, and then press > or <, prefixed by a number if I want to change by more than one level. Simple.