Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue24064

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Make the property doctstring writeable
Type:enhancementStage:resolved
Components:Interpreter CoreVersions:Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: rhettingerNosy List: berker.peksag, cvrebert, ethan.furman, python-dev, rhettinger, serhiy.storchaka
Priority:normalKeywords:easy, patch

Created on2015-04-27 04:53 byrhettinger, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
issue24064.diffberker.peksag,2015-04-27 10:41review
property_clear.diffrhettinger,2015-05-13 09:07review
Messages (11)
msg242098 -(view)Author: Raymond Hettinger (rhettinger)*(Python committer)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 attributeAmong 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)*(Python committer)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 updatedDoc/whatsnew/3.5, but other places in the documentation needs to be updated.
msg242334 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)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)*(Python committer)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)*(Python committer)Date: 2015-05-13 07:12
Perhaps the property class now need set the tp_clear slot?
msg243054 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-05-13 08:10
New changeset1e8a768fa0a5 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)(Python triager)Date: 2015-05-13 09:16
New changesetbde652ae05fd 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)*(Python committer)Date: 2015-05-13 12:17
LGTM.
msg243079 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-05-13 12:23
An example of uncollectable loop if tp_clear is not implemented:class A:    @property    def f(self): passA.f.__doc__ = (A.f,)
msg243111 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-05-13 18:12
New changeset2ddadd0e736d by Raymond Hettinger in branch 'default':Issue#24064: Help property() support GChttps://hg.python.org/cpython/rev/2ddadd0e736d
msg243286 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2015-05-15 23:17
New changeset5262dd507ee5 by Raymond Hettinger in branch 'default':Issue#24064:  Docuement that oroperty docstrings are now writeable.https://hg.python.org/cpython/rev/5262dd507ee5
History
DateUserActionArgs
2022-04-11 14:58:16adminsetgithub: 68252
2015-05-15 23:17:12python-devsetmessages: +msg243286
2015-05-13 18:22:34berker.peksagsetstage: commit review -> resolved
2015-05-13 18:14:33rhettingersetstatus: open -> closed
resolution: fixed
2015-05-13 18:12:46python-devsetmessages: +msg243111
2015-05-13 12:23:37serhiy.storchakasetmessages: +msg243079
2015-05-13 12:17:49serhiy.storchakasetassignee:serhiy.storchaka ->rhettinger
messages: +msg243077
stage: patch review -> commit review
2015-05-13 09:16:12python-devsetmessages: +msg243062
2015-05-13 09:07:30rhettingersetfiles: +property_clear.diff
assignee:rhettinger ->serhiy.storchaka
2015-05-13 08:10:25python-devsetnosy: +python-dev
messages: +msg243054
2015-05-13 07:12:16serhiy.storchakasetmessages: +msg243050
2015-05-13 06:58:20rhettingersetassignee:rhettinger
messages: +msg243048
2015-05-01 17:05:18serhiy.storchakasetnosy: +serhiy.storchaka
messages: +msg242334
2015-05-01 16:38:31cvrebertsetnosy: +cvrebert
2015-04-27 18:36:28ethan.furmansetnosy: +ethan.furman
2015-04-27 10:41:38berker.peksagsetfiles: +issue24064.diff

nosy: +berker.peksag
messages: +msg242107

keywords: +patch
2015-04-27 04:53:07rhettingercreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp