[Tutor] creating and writing to a text file
Cameron Simpson
cs at cskk.id.au
Tue Mar 30 17:21:24 EDT 2021
On 30Mar2021 09:23, Alan Gauld <learn2program at gmail.com> wrote:
>On 30/03/2021 07:18, Cameron Simpson wrote:
>> If you're talking about pyflakes, it's a linter:
>> https://pypi.org/project/pyflakes/
>>
>> It actually promises to not complain about style :-)
>>
>I'm a big fan of linters but I hate formatters.
I have mixed feelings, but yapf can be tuned to very close to my
preferred style anyway.
>There's very little evidence that strict code formatting makes much
>difference
>to comprehension
Aye, but I'm prone to trivial typos (spaces, etc) and poorly formatted
code annoying me, doubly so when it is my own poorly formatted code. It
_is_ very pleasing to me to have a computer apply that rigour for me.
>and in practice I find that different styles apply in
>different
>parts of the code specifically as a way of conveying meaning(*). Formatters
>tend to remove those variations.
>
>I avoid them like the plague!
>
>(*) an example would be building a menu system from a data structure,
>it makes sense to lay the data out to look like the menus. but in other
>places you want it to look like a flat data store. Most formatters
>insist on
>lining everything up according to whatever scheme their author prefers
>(or if you are lucky a config setting)
Yes, this is true. Even yapf doesn't indent dict literals (for eg) as I
want. It _does_ at least have a lexical cue in that a trailing comma
lines all the values up vertically, and no trailing commas makes it fill
the lines.
But I'll take it over hand aligning my code.
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Tutor
mailing list