Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Conversation

@abnsy
Copy link

@abnsy abnsy commented Jun 23, 2021

BUG RISK

Comparisons to the singleton objects, like True, False, and None, should be done with identity, not equality. Use is or is not.
Identity checks are faster than equality checks. Also, the equality checks can result in unintended behaviour in some cases.

Exceptions:
Equality comparisons might be required in some cases, especially in SQLAlchemy, SQLObject, ORMs, etc. In these cases, it is safe to ignore this issue.

BUG RISK

Comparisons to the singleton objects, like True, False, and None, should be done with identity, not equality. Use is or is not.
Identity checks are faster than equality checks. Also, the equality checks can result in unintended behaviour in some cases.

Exceptions:
Equality comparisons might be required in some cases, especially in SQLAlchemy, SQLObject, ORMs, etc. In these cases, it is safe to ignore this issue.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant