Created
February 2, 2018 23:33
-
-
Save catichenor/7bb113de4e5444e1b6ed8b0efe09a8b9 to your computer and use it in GitHub Desktop.
Demonstration of the difference between "is" and "==" in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test = 'hello' | |
print(test[:-1] == 'hell') | |
# returns "True" | |
print(test[:-1] is 'hell') | |
# returns "False", these do not point to the same object in memory. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment