AI engineering glossary · Python core

What is identity operator?

Identity operator (also called is operator): The is and is not operators, which test whether two names refer to the very same object in memory, not merely equal values. It is the correct way to test for None. For value equality use == instead.

Level: intermediateTopic: Python core

Identity operator: an example

a = [1]; b = [1]; a == b is True but a is b is False. Write if x is None: for a None check.

Related terms

More Python core terms

Where you learn it

Identity operator is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.