TGViewer
PyNotes PyNotes @py_notes_uz · 207 subscribers
Post #65 276
there are actually two dunder methods that control how objects are converted to strings in Python 3.
__str__ is one of Python’s “dunder” (double-underscore) methods and gets called when you try to convert an object into a string

Inspecting an object in a Python inter-
preter session simply prints the result of the object’s __repr__ .

Why Every Class Needs a __repr__
If
you don’t add a str method, Python falls back on the result
of __repr__ when looking for __str__ .
More from @py_notes_uz
  1. Oct 13, 2026📢 Ertaga meetup qilyapman Ertaga, 14-oktabr kuni INHA universitetida meetup o'tkazaman. T…
  2. Sep 10, 2026👋 Accepted AI Men sizga orzuingizdagi ishga qabul qilinishda yordam beraman: 📊 CV'ingizn…
  3. May 5, 2026Middle/Senior Full Stack (Python+TypeScript) | Sigma Software Qualifications • 6+ years of…
  4. Apr 16, 2026🇺🇿 o'zbek tilida 🇷🇺 на русском AI Incubator 2026 — Applications Open 🚀 Launch your AI…
  5. Mar 24, 2026Want to learn how AI agents are built at Yandex? The Yandex School of Data Analysis is run…
  6. Feb 17, 2026💡 Python bo'yicha ko'nikmalaringizni sanoat standartlari darajasiga oshirishni va mutaxas…
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 →