The thing about using is for checking equality is that linters actively encourage it. I forget if it is Pylance or Ruff, but one of the linters I use day-to-day Will give me a linter error if I use == to check for None, and tell me to use is
The thing about using is for checking equality is that linters actively encourage it. I forget if it is Pylance or Ruff, but one of the linters I use day-to-day Will give me a linter error if I use == to check for None, and tell me to use is
The thing about using is for checking equality is that linters actively encourage it. I forget if it is Pylance or Ruff, but one of the linters I use day-to-day Will give me a linter error if I use == to check for None, and tell me to use is
Ah, good point.
I would add that PEP 8 specifically recommends the use of `is None`:
"Comparisons to singletons like None should always be done with is or is not, never the equality operators."
peps.python.org/pep-0008/#programming-recommendations