Skip to main content
r/learnpython icon

r/learnpython

members
online

Best extensions for Python Best extensions for Python

I have an annoying issue with Python indentation. I don’t really plan my code — I just start writing — so fixing indentation later becomes insanely frustrating. It got me wondering: what are the best Python extensions or tools for this (or for Python in general)?

Edit - Let me set the context — I didn’t explain this properly earlier.

I forgot to wrap my main() logic in a try/except, and after adding it, I had to manually re-indent this whole match block — which was annoying.

Code:-

match args.command:

case "add" : cmdAdd(args)

case "init" : cmdInit(args)

case "commit" : cmdCommit(args)

case "status" : cmdStatus(args)

case "tag" : cmdTag(args)

case _ : print("Bad command.")

I know I can select everything and press Tab, but that still feels like a hassle. I come from Go, where I mostly just move curly braces and the formatter handles the rest.

Is there any shortcut or extension that can automatically refactor/indent a selected Python block when wrapping it in something like try/except?


Your next job could start with Python. Here’s the roadmap Data Scientists follow. Start for free now.
Image Your next job could start with Python. Here’s the roadmap Data Scientists follow. Start for free now.



Matlab to python? Matlab to python?

Hello, I’m a materials engineering major. I recently learned how to code matlab, as it was a pre/corequisite for what is essentially a statistics/machine learning class. While we won’t be coding often, when we do, it’s in python. Is there any way for me to learn it efficiently in a reasonable amount of time so I can handle it better? This would be my second coding language.

Edit: my first mention of matlab, I accidentally said python. Corrected it to such.