Author gregory.p.smith
Recipients barry, gregory.p.smith, gvanrossum, serhiy.storchaka, steven.daprano, terry.reedy, xiang.zhang
Date 2018-09-30.16:26:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538324790.0.0.545547206417.issue34850@psf.upfronthosting.co.za>
In-reply-to
Content
The problem with a SyntaxWarning is that the wrong people will see it. It gets in the way of users of applications that happen to be written in Python.

scenarios:

(a) A Python interpreter gets upgraded, and suddenly the _users_ of an application start seeing nasty warnings when they invoke the tool that happens to be implemented in Python. Warnings that they have no power to do anything about.

(b) A developer installs the shiny new version of Python with the warning feature, then pip install's all of the dependencies for the application they are working on.  Some of those contain "is" problems so they're left in a situation where they either have to figure out how to fix code from N different transitive dependencies libraries that they are not the author of - or not use that Python version to ship their code.  Keep in mind that it is common for deps to be pinned to ranges of versions instead of "always the latest" so even when deps fix their code, many people won't see it for a long time.

These scenarios are real, this is exactly what happened with the DeprecationWarning added to the old md5.py and sha.py modules.

A warning raised at import time isn't even one that can be meaningfully caught in a well structured application.  Doing so requires importing the warnings module first thing and setting up warning filters before any other imports.  This is ugly boilerplate for anyone to need to resort to.

As much as I want us to do something to ameliorate this anti-pattern in code, I don't think a SyntaxWarning is a great way to do it.
History
Date User Action Args
2018-09-30 16:26:30gregory.p.smithsetrecipients: + gregory.p.smith, gvanrossum, barry, terry.reedy, steven.daprano, serhiy.storchaka, xiang.zhang
2018-09-30 16:26:30gregory.p.smithsetmessageid: <1538324790.0.0.545547206417.issue34850@psf.upfronthosting.co.za>
2018-09-30 16:26:29gregory.p.smithlinkissue34850 messages
2018-09-30 16:26:29gregory.p.smithcreate