Can you give me a lint that you use that you think would be useful for
me to make my code more Pythonic?
Formatting aisde, “Pythonic” is a nebulous term which broadly means
making use of normal Python idioms and approaches, with a preference for
You know, I mostly use LLMs because I like my code to be perfect
(correction: imperfect). I like structure, following guidelines or
checking a box to know I’m doing it right, and so I keep asking LLMs to
make my code conform to the Zen of Python, but it’s so unpredictable.
That is because the Zen is a) a set of guidelines and b) there’s tension
between some of them and c) it doesn’t cover everything anyway.
So your suggestions might help my sanity. Here are the lints I use: pylint, mypy, flake8, black, isort, bandit, autoflake, and pydocstringformatter.
That’s… a lot! Personally I use pyflakes, pycodestyle and pylint. And
I use yapf for autoformatting instead of black. I sort imports by hand.
Also, I have a bunch of exceptions for these to turn off some things I
find annoying i.e. lints which fire on my code for spurious reasons. And
in my personal code I run yapf with a few style overrides.
I aim for close to zero complaints from pylint and few from pyflakes;
note that for some code that is achieved by annotating particular bits
of code with comments to tell pylint to not warn about some particular
line, where its complaint is incorrect (yes, what is complaoins about is
there but no, it is not a problem this time).
Remember than a lot of lint reports are for things which may be
problems or are style deviations (often naming, where using a poor name
lends the code to bugs from the programmer being confused by the name).
A clean lint run is a good objective, particularly if your mind lends
itself to a concrete list of criteria which should be passed. If nothing
else, when code which elicited no complaints is changed, the new
complaints are almsot always because of the change rather than having a
lot of old complaints burying the new ones.
Cameron Simpson email@example.com