Hi Steven, I wish I could blame this on zealots, so let me talk a little bit about how PEP8 works in education, and I'll talk about moving forward in another message.

As mentioned, PEP8 is formally for narrow cases, and includes disclaimers about not applying it mechanically, reflecting a basic reasonableness. Nothing to complain about there.

As a practical matter, the IDEs just default to having PEP8 checking on, and they do it in a very visual way - akin to a text editor which puts little squiggles under words it thinks are misspelled.

This maybe sounds annoying, but looking at how people learn to code, it's actually fantastic, and a giant success for the goals of PEP8. Instead of spending lecture time at some point reviewing rules about spacing or whatever, the students are absorbing that stuff just imperceptibly as the IDE is nudging them the right way by putting little colored marks around code it doesn't like. PEP8 contains a bunch of conventions, and now you have this crop of junior programmers who have absorbed the important ones, thus avoiding future pointless bikeshed wars.

I hope people who care about PEP8 can have a moment of satisfaction, appreciating how IDEs have become a sort of gamified instrument to bring PEP8 to the world at low cost. So that's the good news.

The visual quality that makes the IDEs so effective, also loses all the nuance. I have tried to explain to the students this or that they can let slide, but as a matter of human nature, it's hopeless. They want to get rid of the IDE marked code. And keep in mind, their devotion to that is mostly a force for good.

So this basically great, but rather inflexible dynamic of the students, the IDEs, and PEP8 is what brings me here.

I want to get to a world that is, let's say, "== tolerant". I claim you can teach a nice intro course using == early in the course, and many people have chimed in that they feel there's value in "is". I want to work out a solution between PEP8 and the IDEs where both approaches are permitted.

Let me write up some proposals in a separate message, and people can comment on those.

Best,

Nick






On Mon, Aug 30, 2021 at 6:36 PM Steven D'Aprano <steve@pearwood.info> wrote:
On Mon, Aug 30, 2021 at 11:32:20AM -0700, Nick Parlante wrote:

> As a practical matter, the way this comes up for my students is that
> IDEs by default will put warning marks around PEP8 violations in their
> code.

I'm not fond of linters that flag PEP 8 violations. And if I recall
correctly, I think Guido is likewise not convinced that they are a good
idea.

Anyway, it doesn't matter. Your IDE ought to be configurable to enable
or disable that rule. For example:

https://www.jetbrains.com/help/pycharm/configuring-code-style.html

You ought to be able to come up with a config that disables that
specific rule, and distribute it to your students automatically. You may
need to determine which linter the IDE uses to check for style
violations, and provide a config specifically for that linter.

If you tell us what IDE your school or department uses, we might even be
able to tell you what config you need.

And in practical terms, that will likely be much, much faster than
waiting for us to change PEP 8, the linters to change their tests, and
the IDEs to be updated to use the new versions of the linters.

> Here is my proposal:
>
> Add the following parenthetical to the mandatory-is rule: (this rule
> is optional for code that is not part of an implementation of Python).

None of PEP-8 is mandatory except for the stdlib, and even there, it's
more of a guideline than a rule.

Why do PEP-8 zealots never, ever read the most important rule of PEP-8?
It's right at the top too, just after the introduction. (Sorry Nick,
this is not aimed at you personally.)

https://www.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds



--
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/QSECKF7K4MKOMJGINJFZGLBW4MOKY74Q/
Code of Conduct: http://python.org/psf/codeofconduct/