Issue24064
Created on 2015-04-27 04:53 by rhettinger, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue24064.diff | berker.peksag, 2015-04-27 10:41 | review | ||
| property_clear.diff | rhettinger, 2015-05-13 09:07 | review | ||
| Messages (11) | |||
|---|---|---|---|
| msg242098 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2015-04-27 04:53 | |
I can't see any reason for property docstrings to be readonly:
>>> p = property(doc='basic')
>>> p.__doc__
'basic'
>>> p.__doc__ = 'extended'
Traceback (most recent call last):
File "<pyshell#46>", line 1, in <module>
p.__doc__ = 'extended'
AttributeError: readonly attribute
Among other things, making it writeable would simplify the ability to update the docstrings produced by namedtuple;
Time.mtime.__doc__ = 'modification time'
Score.max = 'all time cumulative high score for a single season'
|
|||
| msg242107 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2015-04-27 10:41 | |
Here is a patch. I'm not familiar with this part of the CPython source. So please tell me if there is a better way to do it. I only updated Doc/whatsnew/3.5, but other places in the documentation needs to be updated. |
|||
| msg242334 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-05-01 17:05 | |
If make docstrings writable, it would be good to ensure that they exactly are strings. And if make the property doctstring writable, may be make other docstrings writable? It may be useful for setting the same docstring for Python implementation and C accelerator. |
|||
| msg243048 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2015-05-13 06:58 | |
> If make docstrings writable, it would be good to ensure > that they exactly are strings. I don't see a need for this restriction. Even regular classes don't enforce this. |
|||
| msg243050 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-05-13 07:12 | |
Perhaps the property class now need set the tp_clear slot? |
|||
| msg243054 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-05-13 08:10 | |
New changeset 1e8a768fa0a5 by Raymond Hettinger in branch 'default': Issue #24064: Property() docstrings are now writeable. https://hg.python.org/cpython/rev/1e8a768fa0a5 |
|||
| msg243062 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-05-13 09:16 | |
New changeset bde652ae05fd by Berker Peksag in branch 'default': Issue #24064: Add __doc__ to the example in collections.rst. https://hg.python.org/cpython/rev/bde652ae05fd |
|||
| msg243077 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-05-13 12:17 | |
LGTM. |
|||
| msg243079 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2015-05-13 12:23 | |
An example of uncollectable loop if tp_clear is not implemented:
class A:
@property
def f(self): pass
A.f.__doc__ = (A.f,)
|
|||
| msg243111 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-05-13 18:12 | |
New changeset 2ddadd0e736d by Raymond Hettinger in branch 'default': Issue #24064: Help property() support GC https://hg.python.org/cpython/rev/2ddadd0e736d |
|||
| msg243286 - (view) | Author: Roundup Robot (python-dev) | Date: 2015-05-15 23:17 | |
New changeset 5262dd507ee5 by Raymond Hettinger in branch 'default': Issue #24064: Docuement that oroperty docstrings are now writeable. https://hg.python.org/cpython/rev/5262dd507ee5 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:16 | admin | set | github: 68252 |
| 2015-05-15 23:17:12 | python-dev | set | messages: + msg243286 |
| 2015-05-13 18:22:34 | berker.peksag | set | stage: commit review -> resolved |
| 2015-05-13 18:14:33 | rhettinger | set | status: open -> closed resolution: fixed |
| 2015-05-13 18:12:46 | python-dev | set | messages: + msg243111 |
| 2015-05-13 12:23:37 | serhiy.storchaka | set | messages: + msg243079 |
| 2015-05-13 12:17:49 | serhiy.storchaka | set | assignee: serhiy.storchaka -> rhettinger messages: + msg243077 stage: patch review -> commit review |
| 2015-05-13 09:16:12 | python-dev | set | messages: + msg243062 |
| 2015-05-13 09:07:30 | rhettinger | set | files:
+ property_clear.diff assignee: rhettinger -> serhiy.storchaka |
| 2015-05-13 08:10:25 | python-dev | set | nosy:
+ python-dev messages: + msg243054 |
| 2015-05-13 07:12:16 | serhiy.storchaka | set | messages: + msg243050 |
| 2015-05-13 06:58:20 | rhettinger | set | assignee: rhettinger messages: + msg243048 |
| 2015-05-01 17:05:18 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg242334 |
| 2015-05-01 16:38:31 | cvrebert | set | nosy:
+ cvrebert |
| 2015-04-27 18:36:28 | ethan.furman | set | nosy:
+ ethan.furman |
| 2015-04-27 10:41:38 | berker.peksag | set | files:
+ issue24064.diff nosy:
+ berker.peksag keywords: + patch |
| 2015-04-27 04:53:07 | rhettinger | create | |