Interview gone wrong
An anecdote about a coding interview for a tic‑tac‑toe task sparks debate after an interviewer wrongly flags Python’s chained comparison syntax (`a == b == c`) as a bug. Commenters unpack how Python’s math‑like comparison chaining works, contrast it with JavaScript and other languages, and argue over whether such “language‑specific tricks” help or hinder readability in interviews and real code. The exchange broadens into criticism of technical interviewing practices, highlighting how interviewer misunderstandings, stress, and style judgments can distort assessments of a candidate’s actual ability.
Python comparison chaining (a == b == c)
- Many see chained comparisons as standard, idiomatic Python that mirrors math notation (e.g.,
5 < x < 25,x == y == 10). - Others find it obscure or unclear, especially coming from languages where it parses as
(a == b) == c. - Discussion highlights edge cases: non‑transitive
__eq__, numpy arrays raising ambiguity errors, and unintuitive behavior with!=. - Some argue Python’s behavior is less surprising than the “C/JS style” once learned; others think introducing a special rule for comparisons increases cognitive load.
- Alternative design choices: D and Rust reject chained comparisons and force explicit
a == b && b == c, which some consider more predictable.
Interview dynamics and evaluation
- Many argue the interviewer erred by confidently misjudging valid Python syntax, confusing the candidate and then blaming the language.
- Others see an opportunity: a strong candidate could explain the semantics, demonstrate checks in a REPL, or rewrite to a clearer form.
- There’s disagreement on using “language tricks” in interviews:
- One view: show idiomatic mastery (e.g., itertools, generators) and communicate tradeoffs.
- Another: avoid constructs the interviewer may not know, or at least be ready to explain them.
- Several commenters criticize judging “style” or concision in a 45‑minute interview; correctness and reasoning are seen as higher signal.
- Some advocate including tests and even looking up documentation live, as that reflects real‑world practice.
Tic‑tac‑toe logic and correctness
- Multiple commenters note that checking only
cell[0][0] == cell[1][1] == cell[2][2]is insufficient: it also matches three empty cells. - Others respond that the overall game flow might avoid this (e.g., only checking after a move on the diagonal), so correctness is unclear from the snippet alone.
Language choice and readability
- Allowing candidates to use any familiar language is common, but interviewing in a language the interviewer doesn’t know well is seen as risky.
- Some prefer avoiding chained comparisons for readability across mixed‑background teams; others argue idiomatic, concise expressions are desirable as long as they’re well understood.