special methods

Table of Contents

1. Special methods

The special methods make user defined objects behave as built in
types. Using them makes the code more "Pythonic". A basic
requirement of Python object is to provide usable string
representaiton using __repr__ and __str__.

??? Is this correct?

  • __repr__: Used for debugging.
  • __str__: Used for presentation to the end user.

Date: 2024-09-25 Wed 17:37

Created: 2025-07-05 Sat 00:00

Validate