
Is there a reason why normal classes can't have their __doc__ strings rewritten? Creating a do-nothing metaclass seems like overkill for such a simple operation. Python 3.2 ... on win32 --> class Test(): ... __doc__ = 'am I permanent?' ... --> Test.__doc__ 'am I permanent?' --> Test.__doc__ = 'yes' Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: attribute '__doc__' of 'type' objects is not writable --> type(Test) <class 'type'> --> class Meta(type): ... "only for exists to allow writable __doc__" ... --> class Test(metaclass=Meta): ... __doc__ = 'am I permanent?' ... --> Test.__doc__ 'am I permanent?' --> Test.__doc__ = 'No!' --> Test.__doc__ 'No!' --> type(Test) <class '__main__.Meta'> Should I create a bug report? ~Ethan~

On Wed, Jan 18, 2012 at 5:01 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
http://bugs.python.org/issue12773 :) -eric

Sreenivas Reddy T <thatiparthysreenivas@gmail.com> writes:
I don't get any syntax errors (Python2.7 and 2.6)
Test.__doc__ 'something'
The __name__, __bases__, __module__, __abstractmethods__, __dict__ and __doc__ attributes have custom getters and setters in the type object definition. __doc__ has only a getter. No setter and no deleter. http://hg.python.org/cpython/file/0b5ce36a7a24/Objects/typeobject.c#l658 That is why you're seeing this. What's the question here? [...] -- ~noufal http://nibrahim.net.in May I ask a question?

Noufal Ibrahim <noufal@nibrahim.net.in> writes: [...]
That is why you're seeing this. What's the question here?
[...] My apologies. I didn't read the whole thread. -- ~noufal http://nibrahim.net.in Some bird populations soaring down -Headline of an article in Science News, page 126, February 20, 1993.

The bug is marked as close, whereas the bug exists in Python 3.2 and has no been closed. The fix must be backported. Victor

Benjamin Peterson wrote:
Where does one draw the line between feature and bug? As a user I'm inclined to classify this as a bug: __doc__ was writable with old-style classes; __doc__ is writable with new-style classes with any metaclass; and there exists no good reason (that I'm aware of ;) for __doc__ to not be writable. ~Ethan~

On Thu, Jan 19, 2012 at 8:36 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
Like it or not, this has worked this way ever since new-style classes were introduced. That has made it a de-facto feature. We should not encourage people to write code that works with a certain bugfix release but not with the previous bugfix release of the same feature release. Given that we haven't had any complaints about this in nearly a decade, the backport can't be important. Don't do it. -- --Guido van Rossum (python.org/~guido)

Guido van Rossum wrote:
Then what's the point of a bug-fix release? If 3.2.1 had broken threading, wouldn't we fix it in 3.2.2 and encourage folks to switch to 3.2.2? Or would we scrap 3.2 and move immediately to 3.3? (Is that more or less what happened with 3.0?)
Like it or not, this has worked this way ever since new-style classes were introduced. That has made it a de-facto feature.
But what of the discrepancy between the 'type' metaclass and any other Python metaclass?
Given that we haven't had any complaints about this in nearly a decade, the backport can't be important. Don't do it.
Agreed. ~Ethan~

On 19/01/2012 17:46, Ethan Furman wrote:
There are many discrepancies between built-in types and any Python class. Writable attributes are (generally) one of them. Michael
-- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html

On Thu, Jan 19, 2012 at 9:46 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
Usually the bugs fixed in bugfix releases are things that usually go well but don't work under certain circumstances. But I'd also be happy to just declare that assignable __doc__ is a feature without explaining why. Like it or not, this has worked this way ever since new-style classes were
introduced. That has made it a de-facto feature.
But what of the discrepancy between the 'type' metaclass and any other
Python metaclass?
Michael Foord explained that. -- --Guido van Rossum (python.org/~guido)

Ethan Furman writes:
Where does one draw the line between feature and bug?
Bug: Doesn't work as documented. Feature: Works as expected but not documented[1] to do so. Miracle: Works as documented.[2] Unspecified behavior that doesn't work as you expect is the unmarked case (ie, none of the above). The Devil's Dictionary defines feature somewhat differently: Feature: Name for any behavior you don't feel like justifying to a user. Footnotes: [1] Including cases where the patch contains documentation but hasn't been committed to trunk yet. [2] Python is pretty miraculous, isn't it?

On 1/19/2012 1:04 PM, Stephen J. Turnbull wrote:
The basic idea is that the x.y docs define (mostly) the x.y language. Patches to the x.y docs fix typos, omissions, ambiguities, and the occasional error. The x.y.z cpython releases are increasingly better implementations of Python x.y. -- Terry Jan Reedy

On Wed, 18 Jan 2012 20:31:38 -0700 Eric Snow <ericsnowcurrently@gmail.com> wrote:
Should I create a bug report?
Well done Eric :)

On Wed, Jan 18, 2012 at 5:01 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
http://bugs.python.org/issue12773 :) -eric

Sreenivas Reddy T <thatiparthysreenivas@gmail.com> writes:
I don't get any syntax errors (Python2.7 and 2.6)
Test.__doc__ 'something'
The __name__, __bases__, __module__, __abstractmethods__, __dict__ and __doc__ attributes have custom getters and setters in the type object definition. __doc__ has only a getter. No setter and no deleter. http://hg.python.org/cpython/file/0b5ce36a7a24/Objects/typeobject.c#l658 That is why you're seeing this. What's the question here? [...] -- ~noufal http://nibrahim.net.in May I ask a question?

Noufal Ibrahim <noufal@nibrahim.net.in> writes: [...]
That is why you're seeing this. What's the question here?
[...] My apologies. I didn't read the whole thread. -- ~noufal http://nibrahim.net.in Some bird populations soaring down -Headline of an article in Science News, page 126, February 20, 1993.

The bug is marked as close, whereas the bug exists in Python 3.2 and has no been closed. The fix must be backported. Victor

Benjamin Peterson wrote:
Where does one draw the line between feature and bug? As a user I'm inclined to classify this as a bug: __doc__ was writable with old-style classes; __doc__ is writable with new-style classes with any metaclass; and there exists no good reason (that I'm aware of ;) for __doc__ to not be writable. ~Ethan~

On Thu, Jan 19, 2012 at 8:36 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
Like it or not, this has worked this way ever since new-style classes were introduced. That has made it a de-facto feature. We should not encourage people to write code that works with a certain bugfix release but not with the previous bugfix release of the same feature release. Given that we haven't had any complaints about this in nearly a decade, the backport can't be important. Don't do it. -- --Guido van Rossum (python.org/~guido)

Guido van Rossum wrote:
Then what's the point of a bug-fix release? If 3.2.1 had broken threading, wouldn't we fix it in 3.2.2 and encourage folks to switch to 3.2.2? Or would we scrap 3.2 and move immediately to 3.3? (Is that more or less what happened with 3.0?)
Like it or not, this has worked this way ever since new-style classes were introduced. That has made it a de-facto feature.
But what of the discrepancy between the 'type' metaclass and any other Python metaclass?
Given that we haven't had any complaints about this in nearly a decade, the backport can't be important. Don't do it.
Agreed. ~Ethan~

On 19/01/2012 17:46, Ethan Furman wrote:
There are many discrepancies between built-in types and any Python class. Writable attributes are (generally) one of them. Michael
-- http://www.voidspace.org.uk/ May you do good and not evil May you find forgiveness for yourself and forgive others May you share freely, never taking more than you give. -- the sqlite blessing http://www.sqlite.org/different.html

On Thu, Jan 19, 2012 at 9:46 AM, Ethan Furman <ethan@stoneleaf.us> wrote:
Usually the bugs fixed in bugfix releases are things that usually go well but don't work under certain circumstances. But I'd also be happy to just declare that assignable __doc__ is a feature without explaining why. Like it or not, this has worked this way ever since new-style classes were
introduced. That has made it a de-facto feature.
But what of the discrepancy between the 'type' metaclass and any other
Python metaclass?
Michael Foord explained that. -- --Guido van Rossum (python.org/~guido)

Ethan Furman writes:
Where does one draw the line between feature and bug?
Bug: Doesn't work as documented. Feature: Works as expected but not documented[1] to do so. Miracle: Works as documented.[2] Unspecified behavior that doesn't work as you expect is the unmarked case (ie, none of the above). The Devil's Dictionary defines feature somewhat differently: Feature: Name for any behavior you don't feel like justifying to a user. Footnotes: [1] Including cases where the patch contains documentation but hasn't been committed to trunk yet. [2] Python is pretty miraculous, isn't it?

On 1/19/2012 1:04 PM, Stephen J. Turnbull wrote:
The basic idea is that the x.y docs define (mostly) the x.y language. Patches to the x.y docs fix typos, omissions, ambiguities, and the occasional error. The x.y.z cpython releases are increasingly better implementations of Python x.y. -- Terry Jan Reedy

On Wed, 18 Jan 2012 20:31:38 -0700 Eric Snow <ericsnowcurrently@gmail.com> wrote:
Should I create a bug report?
Well done Eric :)
participants (11)
-
Antoine Pitrou
-
Benjamin Peterson
-
Eric Snow
-
Ethan Furman
-
Guido van Rossum
-
Michael Foord
-
Noufal Ibrahim
-
Sreenivas Reddy T
-
Stephen J. Turnbull
-
Terry Reedy
-
Victor Stinner