SublimePythonIDE icon indicating copy to clipboard operation
SublimePythonIDE copied to clipboard

getting invalid pep8 e712 warning

Open tjvoll opened this issue 8 years ago • 1 comments

I'm getting a warning that the following should be using is instead of ==.

rows = data.query(schema.Publish).filter(condish == False)

As far as I understand, pep8 specifies that for if statements only.

tjvoll avatar Oct 25 '17 14:10 tjvoll

Your understanding is in error. No worries, it happens to anyone.

PEP8 section:

- Don't compare boolean values to True or False using ==.

Yes:   if greeting:
No:    if greeting == True:
Worse: if greeting is True:

The key part is "Don't compare boolean values to True or False using ==". That applies to all cases, including the one you have questioned. The relation of if to it only applies as an example.

autumnjolitz avatar Oct 31 '17 02:10 autumnjolitz