[Tutor] overloading object for printing?

Alan Gauld alan.gauld at blueyonder.co.uk
Fri Aug 20 22:15:22 CEST 2004

> Is there some equivalent in Python to the to_s()
> method in Java which a class can overload in order to
> customize the output of an object?  Thanks.

Sorry, what does to_s() do exactly?
Its not listed in any of my 3 Java books.

At a guess the __repr__() or __str__() methods might 
be what you want but without knowing what to_s() does 
I can only guess.

Alan G.

More information about the Tutor mailing list