[Python-ideas] A proliferation of (un-)Pythonically programmatic pragmas

Gregory P. Smith greg at krypto.org
Mon Nov 13 18:31:13 EST 2017


fwiw, we're going to need the tool name in any pragma anyways so the
existing thing that should be common is:

# tool-name: meaningfultoken

It seems like the only convention that makes sense to me.

When I saw your flake8 example of "# noqa: F401" I wanted to rip my eyes
out. Because it didn't mention the tool name *and* it used a numeric code.
Tool authors: use descriptive names!  Otherwise it is meaningless to anyone
reading it.  ex:

import rlcompleter  # pylint: disable=unused-import

Nobody will ever question _what_ that means.

-gps

On Mon, Nov 13, 2017 at 2:19 PM Brett Cannon <brett at python.org> wrote:

>
>
> On Mon, Nov 13, 2017, 13:59 Paul Moore, <p.f.moore at gmail.com> wrote:
>
>> On 13 November 2017 at 20:43, MRAB <python at mrabarnett.plus.com> wrote:
>> > On 2017-11-13 19:10, Barry Warsaw wrote:
>> >> The specifics aren't as important as the general use case: multiple
>> >> tools competing for the same valuable real-estate.
>> >>
>> >> I have no ideas how to improve the situation, and of course any
>> solution
>> >> would involve some coordination between all of these tools, but it's
>> >> beginning to feel like a losing battle.  Is there a better way?
>> >>
>> > I suppose that you could have suggest to them that they follow a
>> convention
>> > such as:
>> >
>> > 1. There can be multiple pragmas in a comment, separated by semicolons:
>> if
>> > you don't recognise it, skip past the semicolon.
>> >
>> > 2. A pragma can be prefixed with the name of the tool, e.g. "#
>> flake8.noqa:
>> > F401": if there's a prefix, but it's not yours, skip past the semicolon.
>>
>> An informational PEP defining a common convention for pragma-style
>> comments could standardise things. I'd suggest starting a discussion
>> (somewhere?) with the development teams for the relevant projects
>> (flake8, mypy, coverage...) with the intention of developing such a
>> PEP that they could all support.
>>
>
> And possibly the easiest way to reach them is on the pyqa-dev mailing list.
>
> -brett
>
>
>> Paul
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171113/38c35d75/attachment.html>


More information about the Python-ideas mailing list