[code-quality] Python2 brackets for print statements (C0325)

Carl Crowder carl.crowder at gmail.com
Sun Jan 26 21:41:24 CET 2014


Hi all,

I wanted to canvas your opinion about something.

Currently, if you have a print statement with brackets in Python2, pylint will raise a comment C0325. This is suppressed if "from __future__ import print_statement" is used.

My question is whether or not using print statements with parentheses in python2 should result in a warning. This was brought up as a bug for prospector (see here: https://github.com/landscapeio/prospector/issues/11) and I'm not sure what to decide. On the one hand, without the explicit print function import, the parentheses are superfluous. On the other hand, it is a valid way of making code 2 and 3 compatible. 

My own thoughts are that the correct way of ensuring Python 2 and 3 compatibility is to use the 'from __future__' import, however that's not compatible with 2.5 and lower.

Any thoughts or comments here?

Cheers,
Carl


More information about the code-quality mailing list