[Doc-SIG] suggestions for a PEP
Edward Welbourne <firstname.lastname@example.org>
Thu, 15 Mar 2001 23:41:45 +0000 (GMT)
Edward Loper and Tibs were discussing having B.f borrow A.f's __doc__
when B inherits from A, Tony said assign ...
>> But really you have to do this:
>> B.f.im_func.__doc__ = A.f.__doc__
> Well, I didn't realise that, but (a) that counts as "works" (for an
> odd value of "works", admittedly) and (b) it may change with function
> attributes - don't know.
ah. Just tested what I should have earlier - Edward's right:
>>> def hello(there): return there
>>> hello.__doc__ = 'hello there'
>>> class A:
... def hello(there): return there
>>> A.hello.__doc__ = 'hello there'
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: attribute-less object (assign or del)
>>> A.hello.im_func.__doc__ = 'hello there'
It works for functions but not if they're hanging off the namespace of a
class ? The attribute shows up on the class method after I set it on
the class method's im_func ? This is wrong, obscene and ugly !
Naughty Guido - explain !
But, like I say elsewhere, we shouldn't *need* to be assigning, and:
this smells like we should be using acquisition.