Logo

  • home link icon Home
  • manual link icon Manual
  • blog link icon Blog
  • about link icon About
  • contact link icon Contact

Article Note | built-in python magic-method data-structure



built-in

Python - Magic Method __str__ - Create human-readable object representation

Magic Method __str__ specify what should be returned when we will call str() or print() on our class instance. This method needs to return a string.

It should return human-readable representation of your class. It is meant to help you understand better given object that you are working with.

It shouldn't be confused with __repr__ magic method. The __repr__ method, by contrast, is intended for a more developer-focused, technical representation.

Note | built-in python magic-method
  • ««
  • «
  • 1
  • 2
  • 3
  • 4

Menu

  • home link icon Home
  • manual link icon Manual
  • blog link icon Blog
  • about link icon About
  • contact link icon Contact

Article Note | built-in python magic-method data-structure

Created with ❤ by me, for you!
BLOCK of BYTES - Bite-sized coding lessons for busy developers
© 2025 www.DevCuriosity.com
DevCuriosity Logo
home link icon