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

Barry Warsaw barry at python.org
Mon Nov 13 20:37:50 EST 2017


Gregory P. Smith wrote:
> 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.

One of the things that bother me about end-line comments is that this is
going to blow up line length limits.  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

> 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:

Hah.  One of the things I never imagined was that folks would throw
around numeric PEP numbers and just expect everyone to have PEP 0
tattooed to the back of their eyelids.  Quick, let's discuss PEP 3128!

Cheers,
-Barry



More information about the Python-ideas mailing list