Special string method __str__ in Python objects and how to use it

Anna Ikoki
2 min readJan 27, 2023

Double underscore special variables, attributes, functions, or methods or modules in python objects are user-defined overriding the formally defined one in a hierarchical manner. If defined by the user, they will override the in-built ones, else the formal definition will be used.

desk setup

--

--