This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eric.snow
Recipients eric.snow, michael.foord, ncoghlan
Date 2011-08-17.16:32:37
SpamBayes Score 2.59215e-12
Marked as misclassified No
Message-id <>
Apparently docstrings for classes are immutable:

>>> class X:
...     "some doc"
>>> X.__doc__
'some doc'
>>> X.__doc__ = "another doc"
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
AttributeError: attribute '__doc__' of 'type' objects is not writable

That is on 3.3, but apparently it's the case all the way back to 2.2.
I mentioned this on python-list and several people indicated that it
should be an unnecessary restriction [1].  I also found that this only impacts classes that do not have a custom metaclass.

Regardless, it looks like this is something that no one has take the time to address but would be nice to have done [2][3].  I found that the type_getset for __doc__ does not have a getter:

I have attached a patch that adds one and fixes the problem.  "make test" passed after the fix.

Date User Action Args
2011-08-17 16:32:38eric.snowsetrecipients: + eric.snow, ncoghlan, michael.foord
2011-08-17 16:32:38eric.snowsetmessageid: <>
2011-08-17 16:32:38eric.snowlinkissue12773 messages
2011-08-17 16:32:37eric.snowcreate