how to inherit docstrings?
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Thu Jun 9 10:56:38 EDT 2011
On Thu, 09 Jun 2011 17:44:32 +1000, Ben Finney wrote:
> Eric Snow <ericsnowcurrently at gmail.com> writes:
>
>> AttributeError: attribute '__doc__' of 'type' objects is not writable
>>
>> That is on 3.3.
>
> Well, that sucks :-(
>
> Where can we see the discussion of that change before it was
> implemented?
It goes back to Python 2.2, when new style classes were first introduced.
[steve at sylar ~]$ python2.2
Python 2.2.3 (#1, Aug 12 2010, 01:08:27)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class K(object):
... "foo"
...
>>> K.__doc__ = 'bar'
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: attribute '__doc__' of 'type' objects is not writable
It's an unnecessary restriction, as far as I'm concerned, but an old one.
--
Steven
More information about the Python-list
mailing list