This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Modernize properties
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ethan.furman, serhiy.storchaka
Priority: normal Keywords:

Created on 2017-03-09 17:10 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 585 merged serhiy.storchaka, 2017-03-09 17:12
Messages (5)
msg289309 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-09 17:10
Following PR updates Python sources to use new shiny syntax for properties. It replaces the old code

    def _foo(self):
        ...

    def _set_foo(self, value):
        ...

    foo = property(_foo, _set_foo)

with the new code

    @property
    def foo(self):
        ...

    @foo.setter
    def foo(self, value):
        ...

New syntax was added in Python 2.4.
msg289315 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2017-03-09 17:32
Have you made sure nothing calls the replaced functions manually?

Such as:

    ...
    self._set_foo(9)
    ...
msg289316 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-09 17:38
I replaced only private getters and setters. All tests passed.
msg289325 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-09 20:09
I have checked and none from replaced function is used. But just for the case I reverted changes for Lib/xml/dom/. Here used more complex logic for generating other properties.
msg290165 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-24 22:09
New changeset bdf6b910f9ea75609caee498a975af03b6d23f67 by Serhiy Storchaka in branch 'master':
bpo-29776: Use decorator syntax for properties. (#585)
https://github.com/python/cpython/commit/bdf6b910f9ea75609caee498a975af03b6d23f67
History
Date User Action Args
2022-04-11 14:58:44adminsetgithub: 73962
2017-03-24 22:09:17serhiy.storchakasetmessages: + msg290165
2017-03-19 06:41:14serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-03-09 20:09:28serhiy.storchakasetmessages: + msg289325
2017-03-09 17:38:57serhiy.storchakasetmessages: + msg289316
2017-03-09 17:32:29ethan.furmansetnosy: + ethan.furman
messages: + msg289315
2017-03-09 17:12:28serhiy.storchakasetpull_requests: + pull_request482
2017-03-09 17:10:02serhiy.storchakacreate