# Emulate the old behavior of method.__repr__ when printing, # which called repr() on the receiver... def __str__(self): return f'' method.__str__ = __str__ class Foo(object): def __str__(self): return '' def __repr__(self): return '' print('Foo:',Foo()) print(str(Foo())) print(repr(Foo())) print(Foo().__str__) print(Foo().__repr__)