On 6/10/2011 3:31 AM, Gregory Ewing wrote:
Eric Snow wrote:
But for "method" objects (really a wrapper for
bound functions) would it change the __doc__ of the wrapper or of the
bound function?

You probably wouldn't want to change the __doc__ of a method
wrapper; instead you'd make sure you got hold of the underlying
function first. So __doc__ on method wrappers should probably
remain read-only to avoid surprises.

In 3.x there are no general method wrappers; only bound methods. The .__doc__ attribute of bound methods equals and I am very sure *is* the doc string of the underlying function, accessed through a custom method.__getattr__. It is not writable through the bound method. I presume this is because method.__setattr__ blocks the write. Directly binding a new string to the underlying function does work.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to