[Python-ideas] A proliferation of (un-)Pythonically programmatic pragmas
steve at pearwood.info
Tue Nov 14 21:14:57 EST 2017
On Tue, Nov 14, 2017 at 05:12:10PM -0800, Chris Barker wrote:
> On Mon, Nov 13, 2017 at 5:37 PM, Barry Warsaw <barry at python.org> wrote:
> > One of the things that bother me about end-line comments is that this is
> > going to blow up line length limits.
> Is that a problem? the linters can ignore lines to long if they are only
> too long due to one of these :-)
Yes, it is a problem. See below.
> > I think this could work if such
> > pragma comments could apply to the following line, and multiline pragmas
> > would be acceptable. Then you could have something like:
> > # flake8: disable=unused-import
> > # mypy: alias=pathlib2.Path
> > # coverage: ignore=when>py2.7
+1 to this.
> I'd much rather have the tools all look at the entire comment for their
> particular pragma.
I have no objection to tooling supporting that as well.
> and then, even if you wanted to put it on the previous line, you would't
> have the line-length issue:
> # flake8: disable=unused-import mypy: alias=pathlib2.Path coverage:
And the irony is that this shows exactly why it is still a problem. Code
gets emailed, and lines get wrapped, breaking the too-long line.
Even today, we're not entirely paperless, and code gets printed, either
trunctating or wrapping too long lines. And of course, code gets read,
including comments, and too long lines are, well, too long.
More information about the Python-ideas