pep8 Re: Posting warning message

Tamara Berger brgrt2 at gmail.com
Thu Jun 14 01:34:09 EDT 2018


Is it possible to do the "linting" after you've written your code but
before you install it for the first time?

Tamara
On Wed, Jun 13, 2018 at 12:30 AM Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 13Jun2018 00:05, Tamara Berger <brgrt2 at gmail.com> wrote:
> >Thanks for the in-depth answer. I'm going to have to read it
> >carefully, with the help of a Python glossary. Some of the terms you
> >use are new to me.
>
> No worries. Just ask if you don't find definitions.
>
> BTW, a "lint" program, or "linter" is a program for reporting on style trivia,
> trivial logic errors like variable used before defined (or never defined, which
> is often a typing error misspelling a variable or function name), and things
> that look like they might be bugs (a common mistake of mine is constructing
> exceptions like logging calls, and one of my linters has found dozens of these
> for me.)
>
> >>or am I supposed to root around for my module and make the edits one by one?
> >
> >I was trying to be amusing and didn't get my point across.
>
> Ah, ok then. Easy for stuff like that to fall flat in email.
>
> >>Finally, no you don't normally root around and change an installed module.
> >>Instead, modify your original copy and reinstall the newer version!
> >
> >What I meant was, do I have to open the file, search for, e.g., colons
> >and insert space after them? These were the sorts of picayune errors
> >picked up by PEP8 on my program. I deliberately omit such spaces when
> >I code because I like to do as little unnecessary work as possible.
> >There is enough repetitive coding as it is. I know some IDEs have word
> >completion suggestion for variables, etc, that the user creates. But
> >I'm practicing in barebones IDLE and that means a lot of extra work.
>
> Regrettably, yes, unless you're using an editor that has autoformatting
> support. Learn typing habits which minimise stuff like that, it saves going
> back later.
>
> I don't use IDEs on the whole, and I don't use an autoformatter for Python. My
> environment tends to be an editor window and a shell to run things from (thus:
> 2 terminals, one running vim and one running a shell).
>
> Training your fingers to do the trivia reflexively helps. And leaving the
> linting until _after_ you've got your code working correctly helps, because you
> aren't changing tasks midstream and you are linting code you've deleted or
> changed :-)
>
> An editor with syntax support can help. I use vi or vim, and its syntax support
> is fairly crude. Two things its does have which I use a lot is autoindent (as
> simple as starting the next line at the same indent as the one I just
> completed) and syntax highlighting, which colours keywords and identifiers and
> strings differently. When you make trivial mistakes like not closing a quote or
> misspelling a keyword or leaving off a colon there is often a visual cue.
>
> Cheers,
> Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list