quantifiedcode / python-anti-patterns

An open collection of Python anti-patterns and worst practices.
https://quantifiedcode.github.io/python-anti-patterns
Other
1.71k stars 249 forks source link

Headline "Test for object identity should be is" doesn't match content #131

Open hjp opened 5 years ago

hjp commented 5 years ago

Apart from being phrased the wrong way (the headline names the pattern, not the anti-pattern), it doesn't match the content.

The anti-pattern is about using is for equality tests, not about using something besides is for identity tests.

The headline should be changed to "Using is for equality testing" or something like that.

(There should probably also be an anti-pattern "Using == for identity testing" - I see stuff like x == None or (worse) x == True far more often than a misguided is)