diff --git a/src/core_codemods/docs/pixee_python_literal-or-new-object-identity.md b/src/core_codemods/docs/pixee_python_literal-or-new-object-identity.md index f634c3c4..88a5154a 100644 --- a/src/core_codemods/docs/pixee_python_literal-or-new-object-identity.md +++ b/src/core_codemods/docs/pixee_python_literal-or-new-object-identity.md @@ -1,4 +1,4 @@ -The `is` and `is not` operator will only return `True` when the expression have the same `id`. In other words, `a is b` is equivalent to `id(a) == id(b)`. New objects and literals have their own identities and thus shouldn't be compared with using the `is` or `is not` operators. +The `is` and `is not` operators only evaluate to `True` when the expressions on each side have the same `id`. In other words, `a is b` is equivalent to `id(a) == id(b)`. With few exceptions, objects and literals have unique identities and thus shouldn't generally be compared by using the `is` or `is not` operators. Our changes look something like this: diff --git a/src/core_codemods/literal_or_new_object_identity.py b/src/core_codemods/literal_or_new_object_identity.py index db9ec4e2..c75f6d55 100644 --- a/src/core_codemods/literal_or_new_object_identity.py +++ b/src/core_codemods/literal_or_new_object_identity.py @@ -16,8 +16,7 @@ class LiteralOrNewObjectIdentityTransformer( LibcstResultTransformer, NameAndAncestorResolutionMixin ): - - change_description = "Replaces is operator with ==" + change_description = "Replace `is` operator with `==`" def _is_object_creation_or_literal(self, node: cst.BaseExpression): match node: @@ -80,7 +79,7 @@ def leave_Comparison( LiteralOrNewObjectIdentity = CoreCodemod( metadata=Metadata( name="literal-or-new-object-identity", - summary="Replaces is operator with == for literal or new object comparisons", + summary="Replace `is` with `==` for literal or new object comparisons", review_guidance=ReviewGuidance.MERGE_WITHOUT_REVIEW, references=[ Reference(