Add text that elaborates on 'is' with '=' (#21537)

I added text that explicitly states the 'is' is signified with '=' since that was not already written and can help beginners distinguish better.
This commit is contained in:
Paula Milenkova
2018-11-14 05:38:40 -08:00
committed by Tom
parent a5958a98c7
commit 38862b6f9c

View File

@ -1,7 +1,7 @@
---
title: Difference between Python 'is' and '==' operators
---
`is` is a check for object identity - ie, checking if two or more variables are referring to the same object. You can't overload `is`.
`is` is a check for object identity - ie, checking if two or more variables are referring to the same object. You can't overload `is`. That object identity is established and assigned with `=`.
`==` evaluates to true if object referred to by the variables are equal. You can overload `==` via the `__eq__` operator.