[code-quality] [Python-projects] New warning about print parens not a good idea?
Sylvain Thénault
sylvain.thenault at logilab.fr
Thu Feb 6 10:07:28 CET 2014
On 06 février 07:24, Carl Crowder wrote:
> I recently asked about the same thing, although there wasn't much discussion as a result.
>
> Pylint is aware of "from __future__ import print_function" and using it will suppress this warning you are seeing. However that is not available for Python 2.5, so it depends on what kind of compatibility you're aiming for, I guess.
>
> Given that the __future__ import exists, my preference is that pylint does warn, as using brackets near a print statement like that could represent a mistake and it's better to warn too much than too little. However I would also like to see a new error code for the print statement alone. Currently the 'superfluous-parens' warning covers all cases including 'if' and 'for' statements etc. A separate error code for the print statement/function would allow people to disable it independently and not remove the other useful warnings.
that + not printing it if related __future__ import is detected would be great.
--
Sylvain Thénault, LOGILAB, Paris (01.45.32.03.12) - Toulouse (05.62.17.16.42)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
CubicWeb, the semantic web framework: http://www.cubicweb.org
More information about the code-quality
mailing list