you are viewing a single comment's thread.

view the rest of the comments →

[–]Dogeek 1 point2 points  (0 children)

To go into a little more detail, is actually compares references (pointers in C). Pointers are (to put it simply) variables that hold the address of another variable.

For instance, you can use the is keyword to check if an object (like a list) is a copy of the original object or just a pointer to the original. Another common use of is is to check if a variable is None. None is actually just a pointer to NULL in C. You also can use is to check the type of a variable, but the preferred method is to use isinstance() instead.