Re: [Python-Dev] readonly __doc__

2009-10-23 Thread Nick Coghlan
Steven D'Aprano wrote: On Fri, 23 Oct 2009 05:39:53 am Brett Cannon wrote: Is __doc__ not normal due to its general underscorishness, or is it not normal because it isn't? I honestly don't follow that sentence. But __doc__ is special because of its use; documenting how to use of an object.

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Daniel Fetchinson
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

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Guido van Rossum
On Thu, Oct 22, 2009 at 9:45 AM, Antoine Pitrou solip...@pitrou.net wrote: 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__'

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Yuvgoog Greenle
On Thu, Oct 22, 2009 at 7:12 PM, Guido van Rossum gu...@python.org wrote: Yes. Why? --yuv ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Antoine Pitrou
Guido van Rossum guido at python.org writes: On Thu, Oct 22, 2009 at 9:45 AM, Antoine Pitrou solipsis at pitrou.net wrote: 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

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Guido van Rossum
Well __doc__ isn't a normal attribute -- it doesn't follow inheritance rules. On Thu, Oct 22, 2009 at 10:25 AM, Antoine Pitrou solip...@pitrou.net wrote: Guido van Rossum guido at python.org writes: On Thu, Oct 22, 2009 at 9:45 AM, Antoine Pitrou solipsis at pitrou.net wrote: Speaking of

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Alexander Belopolsky
On Thu, Oct 22, 2009 at 1:25 PM, Antoine Pitrou solip...@pitrou.net wrote: .. I might add why I was asking this question. I was trying to demonstrate the use of class decorators and the simplest example I found was to add a docstring to the class. I always thought that read-only __doc__ was

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread sstein...@gmail.com
On Oct 22, 2009, at 1:58 PM, Guido van Rossum wrote: Well __doc__ isn't a normal attribute -- it doesn't follow inheritance rules. Maybe we could add a ticket to flag this in the docs. Is __doc__ not normal due to its general underscorishness, or is it not normal because it isn't? Any

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Brett Cannon
On Thu, Oct 22, 2009 at 11:18, sstein...@gmail.com sstein...@gmail.comwrote: On Oct 22, 2009, at 1:58 PM, Guido van Rossum wrote: Well __doc__ isn't a normal attribute -- it doesn't follow inheritance rules. Maybe we could add a ticket to flag this in the docs. Sure, go for it. Is

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread sstein...@gmail.com
On Oct 22, 2009, at 2:39 PM, Brett Cannon wrote: On Thu, Oct 22, 2009 at 11:18, sstein...@gmail.com sstein...@gmail.com wrote: On Oct 22, 2009, at 1:58 PM, Guido van Rossum wrote: Well __doc__ isn't a normal attribute -- it doesn't follow inheritance rules. Maybe we could add a

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Antoine Pitrou
Brett Cannon brett at python.org writes: I honestly don't follow that sentence. But __doc__ is special because of its use; documenting how to use of an object. In this case when you call something like help() on an instance of an object it skips the instance's value for __doc__ and goes

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Guido van Rossum
On Thu, Oct 22, 2009 at 1:49 PM, Antoine Pitrou solip...@pitrou.net wrote: Brett Cannon brett at python.org writes: I honestly don't follow that sentence. But __doc__ is special because of its use; documenting how to use of an object. In this case when you call something like help() on an

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Antoine Pitrou
Le jeudi 22 octobre 2009 à 13:59 -0700, Guido van Rossum a écrit : I don't really understand how this explains the read-only __doc__. I am talking about modifying __doc__ on a class, not on an instance. (sure, a new-style class is also an instance of type, but still...) Antoine, it's not

Re: [Python-Dev] readonly __doc__

2009-10-22 Thread Steven D'Aprano
On Fri, 23 Oct 2009 05:39:53 am Brett Cannon wrote: Is __doc__ not normal due to its general underscorishness, or is it not normal because it isn't? I honestly don't follow that sentence. But __doc__ is special because of its use; documenting how to use of an object. In this case when you