QUESTION 15 OF 15

What is the difference between is and ==?

Reveal the answer and explore the explanation.

15
MediumHigh priority

What is the difference between is and ==?

Answer
Answer

The is operator tests object identity, while == tests equality according to object semantics.

Practical example

Use is None to test for the None singleton.

Reference: Further reading ↗

Last 30 min revisionHigh-yield interview Q&As