TGViewer
Programming & QA Programming & QA @smartiqa · 322 subscribers
Post #623 108
Вопрос №174

Q: Приведите примеры magic (dunder) методов.

A: Работа с объектом класса: new(), init(), del(). Сравнение: eq(), ne(), lt(). Арифметические операторы: add(), sub(), div(). Информация о своем классе: str(), repr(), dir(), sizeof(). Контроль доступа к атрибутам: getattr(), setattr(). Методы, которые используют контейнеры: len(), getitem(), setitem(), iter(), contains(). Вызов объекта: call(). Контекстный менеджер: enter(), exit().
More from @smartiqa
  1. Aug 29, 2026photo post
  2. Aug 26, 2026Вопрос №179 Q: Как удалить первые 100 элементов из списка? A: del my_lst[0:100]
  3. Aug 22, 2026photo post
  4. Aug 19, 2026Вопрос №178 Q: Что выведет данный код?
  5. Aug 15, 2026photo post
  6. Aug 12, 2026Вопрос №177 Q: Что такое GIL? A: Python Global Interpreter Lock - это механизм блокировки,…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →