how to inherit docstrings?

Duncan Booth duncan.booth at invalid.invalid
Thu Jun 9 07:23:02 EDT 2011


Ben Finney <ben+python at benfinney.id.au> 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?
> 

Change? What change?

C:\Python27>python
Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit 
(Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> class C(object):
...    "Hello world"
...
>>> C.__doc__ = "whatever"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: attribute '__doc__' of 'type' objects is not writable
>>>


Or even:
Python 2.3.5 (#1, Oct 13 2005, 09:17:23)
[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class C(object):
...    "Hello world"
...
>>> C.__doc__ = "whatever"
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: attribute '__doc__' of 'type' objects is not writable
>>>


-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list