Tag view

#protocols

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with protocols

1 card

Python Hard Theory

Iteration, comparison, and callable special methods in Python

Methods like `__iter__`, `__next__`, `__call__`, `__eq__`, `__lt__`, and `__hash__` define how custom objects participate in loops, comparisons, hashing, and callable syntax.

  • Iterators use `__iter__` and `__next__`
  • Ordering and equality use rich comparison methods
  • Hashing must stay consistent with equality

Iteration, comparison, and callable special methods in Python