> Speaking of the __doc__ property, I just noticed the following thing on
> py3k:
>
>>>> class C: pass
> ...
>>>> C.__doc__ = "hop"
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: attribute '__doc__' of 'type' objects is not writable

Happens also with new style classes in python 2.x:

Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class C(object): pass
...
>>> C.__doc__ = 'hello'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: attribute '__doc__' of 'type' objects is not writable
>>>


But not with old style classes:


Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class C: pass
...
>>> C.__doc__ = 'hello'
>>>

Cheers,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to