default repr?

Chris Angelico rosuav at
Mon Jul 23 00:54:00 CEST 2012

On Mon, Jul 23, 2012 at 8:48 AM, Dan Stromberg <drsalists at> wrote:
> If a class has defined its own __repr__ method, is there a way of getting
> the default repr output for that class anyway?

Methods are just functions, and you can call any method of any class
with any object as its first parameter.


Though this mightn't work with everything. I wasn't able to paint a
list as a tuple - "tuple.__repr__([1,2,3])" threw a TypeError. Oh
well. There's a limit to the ways Python lets you shoot yourself in
the foot.


More information about the Python-list mailing list