Tag view

#dunder

Cross-subject tag search for related interview cards.

Clear

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

Tagged with dunder

2 cards

Python Medium Theory

Common special methods like `__str__`, `__repr__`, `__len__`, `__getitem__`, and `__contains__`

Special methods let your objects behave like built-in types in printing, indexing, length checks, and membership operations.

  • `__str__` is user-friendly output
  • `__repr__` should be unambiguous
  • Container protocols come from dunder methods

Common special methods like `__str__`, `__repr__`, `__len__`, `__getitem__`, and `__contains__`

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