As some people comments, Python comparisons can be chained.
For the sake of explanation, when chaining, Python actually ANDs the expressions.
The rationale behind this, is that expressions like a < b < c
have the interpretation that is conventional in mathematics. Hence the confusion of your particular expression None is None is None
where identy operators are involved.
So basically, this would translate to:
(None is None) and (None is None)
which is clearly True
Here is another example in the Python docs
Further Information
Especially since this was an interview question, it is important to note that this is not a general behavior shared among all languages.
As it is stated in the documentation I linked,
Unlike C, all comparison operations in Python have the same priority,
which is lower than that of any arithmetic, shifting or bitwise
operation.
So, let's consider the 10 > x > 2
expression (since is
operator is not valid in C).
C's translation (because of operator precedence)
((10 > x) > 2)
Python's translation
(10 > x) and (x > 2)