Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 0316: Modernize code: == None -> is None #2081

Merged
merged 1 commit into from Sep 21, 2021

Conversation

@DimitriPapadopoulos
Copy link
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Sep 19, 2021

Change inspired by PEP 0290 (Code Migration and Modernization):

Since there is only one None object, equality can be tested with identity. Identity tests are slightly faster than equality tests. Also, some object types may overload comparison, so equality testing may be much slower.

Pattern::

if v == None  -->  if v is None:
if v != None  -->  if v is not None:

The existing code runs without errors, there is no need to fix this other than "modernization" of the code.

@brettcannon brettcannon merged commit 29344b5 into python:master Sep 21, 2021
2 checks passed
@DimitriPapadopoulos DimitriPapadopoulos deleted the pep-0316 branch Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants