[Python-Dev] Issue #26204: compiler now emits a SyntaxWarning on constant statement
John Mark Vandenberg
jayvdb at gmail.com
Mon Feb 8 17:14:36 EST 2016
On Tue, Feb 9, 2016 at 8:51 AM, Victor Stinner <victor.stinner at gmail.com> wrote:
> 2016-02-08 22:28 GMT+01:00 Alexander Walters <tritium-list at sdamon.com>:
>> What incantation do you need to do to make that behavior apparent?
>
> I didn't know. I just checked. It's assert used with a non-empty tuple:
>
>>>> assert ("tuple",)
> <stdin>:1: SyntaxWarning: assertion is always true, perhaps remove parentheses?
And pyflakes also has a check for this, but it is similarly tight.
https://github.com/pyflakes/pyflakes/pull/51
It seems that the pyflakes maintainers tend to only accepts patches
for scenarios that Python does emit a SyntaxWarning.
So it is a bit of catch-22 there wrt unused constants.
pylint of course reports these unused constants with its message id
"pointless-statement".
--
John Vandenberg
More information about the Python-Dev
mailing list