C0326 not picking up whitespace before open bracket with print
Hi, While using pylint I have found that having a space between 'print' and the open bracket is allowed. Based on the PEP8 pet peeves I would have assumed that 'print ("hello!")' would have raised the C0326 warning. Is there a reason why this is not the case? I can't seem to find a post anywhere talking about allowing this. Thank you, Mark
* Mark McDowall <mark.mcdowall@gmail.com>, 2018-04-24, 09:38:
Based on the PEP8 pet peeves I would have assumed that 'print ("hello!")' would have raised the C0326 warning.
Is there a reason why this is not the case?
I tested with Pylint 1.8.4 + astroid 1.6.3. With Python 3.6, I actually do get a warning, as expected: C: 1, 0: No space allowed before bracket print ("hello!") ^ (bad-whitespace) With Python 2.7, I don't get any warning. But again, this is expected, because print isn't a function in Python 2. One could even argue that Pylint should warn when the space after "print" is missing. Now, if you're using "from __future__ import print_function", then print is a function, even in Python 2. Pylint doesn't emit the warning in this case, which I think is a bug. -- Jakub Wilk
participants (2)
-
Jakub Wilk
-
Mark McDowall