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

Barry Warsaw barry at python.org
Mon Nov 20 14:50:30 EST 2017


Chris Barker wrote:

> but whatever -- multiple line pragmas are fine, too -- I'm hoping putting
> this much crap in your code will be rare :-)

For sure.  It's not uncommon for you to need two pragmas, e.g. flake8
and coverage, but it's pretty rare to need those *plus* mypy.  It does
happen though.

And while I agree it's better to fix the problem, there are lots of
reasons why you can't.  Multiple-version support in libraries is one
common reason (e.g. this code path will never be taken in Python 2 and
the alternative will never be taken in Python 3), bugs in the tools
(false positives), etc.

Cheers,
-Barry




More information about the Python-ideas mailing list