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.
>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.
>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.
On Tue, Jun 12, 2018 at 8:17 PM Cameron Simpson <c...@cskk.id.au> wrote:
> On 12Jun2018 07:51, Tamara Berger <brg...@gmail.com> wrote:
> [... snip ...]
> >One more thing about PEP8. My workbook is a bit skimpy on details. Is there a
> >quick way to make the edits
> PEP8 is a style recommendation for Python code:
> It is followed pretty rigorously in the Python standard library, and most
> Python code follows a lot of it as a matter of good practice, in that (a) it
> a fairly good style, producing easy to read code and (b) when everyone uses
> same or similar styes, we all find other people's code easier to read.
> But it is not enforced.
> There are several "lint" tools around which will look at your code and
> about violations of PEP8 and various other constraints generally held to be
> good to obey, particularly some kinds of initialisation errors and other
> practices that while syntacticly legal may indicate bugs or lead to header to
> debug or maintain code.
> Also, some text editors have facilities for autostyling code, sometimes as you
> type it and sometimes as a final step when you save the modified file.
> For example, there are tools like autopep8
> which will modify python code directly to apply the PEP8 style.
> Personally, I run a few lint commands against my Python code by hand, and hand
> repair. Typical workflow goes:
> - modify code for whatever reason (add feature, fix bugs, etc) and test
> - when happy, _then_ run a lint tool and tidy up most of what it reports
> - _then_ instal the code where other things may use it (eg pip install)
> My personal kit has a "lint" shell script:
> which runs my preferred linters against code files, and for Python it runs:
> - pyflakes: https://pypi.org/project/pyflakes/
> - pep8: https://pypi.org/project/pep8/
> - pylint: https://pypi.org/project/pylint/,
> These can all be installed using pip:
> pip install --user pyflakes pep8 pylint
> As you can see from my lint script I run them with various options that
> oveeride their default checks to better match my preffered code style.
> >or am I supposed to root around for my module and make the edits one by one?
> Finally, no you don't normally root around and change an installed module.
> Instead, modify your original copy and reinstall the newer version!
> Cameron Simpson <c...@cskk.id.au>