Python has is and is not as operators Some people confuse them with and They are not the same x is y is True if and only if x and y are the same object It is not the same as comparing the ID: 650457
Download Presentation The PPT/PDF document "The “is” operator The is operator" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
The “is” operatorSlide2
The is operator
Python has “is” and “is not” as operators
Some people confuse them with == and !=
They are not the same!
x is y is True if and only if x and y are
the same object
It is not the same as comparing the
values
of the objects
You can think of it as asking if the addresses of two things are the same (although that is strictly an implementation detail and could
be done differently
in different versions of Python)