Another of Python features is a great REPL: when unsure or confused by an interviewer, I'd just fire python from shell and type in 'x' == 'x' == 'x' to confirm and demonstrate it does the right thing (or write tests).
Obviously, the interviewer should be careful not to sidetrack the candidate much, and let them do the work and attempt to help only if things don't work out.
I was told later that while I “obviously knew Python quite well, it didn’t give a good signal for my capabilities.”
If I see such a situation I usually ask the interviewer whether they want a concise solution using libraries or they want to see how I would do this if I had to do it from scratch.
Or I just offer both, I show that I can do it, but that I know it would be easier to do with x.
I think this is a great opportunity to show you're a good communicator as well as a problem solver.
found = searched_key in list(large_dict)
vs found = searched_key in large_dict
But also compare: searched_key in large_dict.keys() # O(1)
and searched_value in large_dict.values() # O(n)I've used Python for 20+ years, and while I'd confidently use a == b == c or 1 < a < 10, I didn't know the specifics and wouldn't use it in cases like 10 > a < 8 (or really, any other case chaining supports).
I believe myself to be an expert at Python and I'll explain differences between different loop types (while/for, ranges/iterators/generators, list comprehensions, functools, external C libraries like pandas or numpy), I think I wouldn't be confused only because I am aware I don't know the details and have a quick way to prove it works.
I got the impression that the candidate was repeating the x == y == z pattern because they'd seen it in other people's code and was pretty sure it worked, not because they knew about comparison chaining. At minimum I'd expect a candidate to be able to clarify that (x == y) == z is not the same thing, not just "idk it works whenever I do it". My reaction to that was: at some point, you do need to at least be able to reason about your own code.
In a more generous light, yes, I agree with everything you wrote. The precise details of comparison chaining are out of scope and I'm sure that most Python developers (myself included) don't know or remember them.
I don't think that anyone who main programs in Python would perceive it as some kind of cool/unusual trick and not just normal code.
If you're giving interviews, and evaluating code in a language you don't know, don't be so confident it's wrong. Ask the candidate how it works.
The important part here is that there are a substantial fraction of python developers that don't share your sentiment.
"Confusing" the interviewer is a totally valid strategy! It's the only strategy when python async is involved!