Is there a way in Python to specify a custom print method (or equivalent) for a class? Borrowing a concept from the R language (and possibly others) what I would like it a way for the interpreter to know that when I type
obj
which is assumed to mean
print(obj)
it should use my custom method to print some details about the object, instead of telling me the type and memory address. Is there such a feature or similar in python?