On Thu, Feb 21, 2019 at 6:48 AM Jonathan Fine <jfine2...@gmail.com> wrote:
> Here's a suggestion, at least for people projects that use black.py
> (such as Samuel's). It is to use black.py with a line-length of say 80
> characters for code that is saved in version control. And when editing
> code, use whatever line-length that happens to suit the tools you are
> using.
>
> Indeed, like a word-processor, one could use black.py to 'line-wrap'
> the Python code to what is the current width of the editor window.

>From my experience (granted, I work heavily with students, so maybe
it's different if everyone involved in the project has 5+ or 10+ years
coding), autoformatters are a blight. They take a simple, easy-to-find
missed parenthesis, and completely obscure it by reindenting the code
until it finds something unrelated that seems to close it. The
indentation in the code of even a novice programmer is valuable
information about *programmer intent*, and throwing that away
automatically as part of checking in code (or, worse, every time you
save the file) is a bad idea. Easy bugs become hard.

Of course, if you assume that everything in your code is perfect, then
by all means, reformat it however you like. If you're 100% confident
that nobody writes any buggy code, then the formatting doesn't matter,
and you can display it in whichever way looks prettiest. But if you
appreciate ways of discovering bugs more easily, preserve everything
that represents the programmer's intention.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to