__str__ vs. __repr__

Thomas Heller thomas.heller at ion-tof.com
Thu Nov 4 08:32:46 EST 1999


> How about a hook function a la __import__? I.e. have a function
> __format__ [1] in __builtin__ that is bound to repr by default. Whenever
> Python prints the result of an expression in interactive mode, it calls
> __format__ with the result as parameter and expects it to return a
> string ready for printing.

But you have a custom python interpreter, don't you? Or how do you
manage to use your __format__ as the printer for interactive mode?

Thomas Heller





More information about the Python-list mailing list