Printable string for 'self'

Don Taylor nospamformeSVP at gmail.com
Tue Mar 14 21:02:35 EST 2006


Is there a way to discover the original string form of the instance that 
is represented by self in a method?

For example, if I have:

	fred = C()
	fred.meth(27)

then I would like meth to be able to print something like:

	about to call meth(fred, 27) or
	about to call fred.meth(27)

instead of:

	about to call meth(<__main__.C instance at 0x00A9D238>, 27)

Thanks in advance,

Don.




More information about the Python-list mailing list