V
26

PSA: A library user in Seattle showed me why I should lint my Python code

I was helping a guy debug a script at the downtown Seattle public library last month, and he pointed out how messy my indentation was. He showed me how a linter catches spacing issues and missing colons before you even run the code. I spent maybe 30 minutes setting up flake8 in VS Code after that chat. Has anyone else had a random stranger at a coffee shop or library teach them a coding habit that stuck?
3 comments

Log in to join the discussion

Log In
3 Comments
grant155
grant15512d ago
Bruh, that's a whole different discussion. @the_mia you're right that a linter won't catch syntax errors, but honestly the real value is how it trains you to write cleaner code over time. I had a similar thing happen when a guy at a coffee shop showed me how pylint catches unused imports - I never thought twice about leaving those in there until I saw how much junk I was dragging into my scripts. The indentation thing is huge too, not just for running code but for readability when you come back to it six months later. That library guy probably saved you from a ton of headaches down the road.
5
alice_allen5
Did you actually mean that he showed you how a linter catches those errors, or that he convinced you to start using one? Flake8 is great, but it won't catch missing colons - that's a syntax error Python itself will flag.
2
the_mia
the_mia12d ago
Haha yeah, @alice_allen5, you're spot on - I guess I was giving Flake8 a little too much credit for catching something the interpreter would've screamed about anyway. Oops, my bad for mixing up the tools there!
6