classification
Title: Remove the __set__ method restriction on data descriptors for attribute lookup precedence
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: docs@python, maggyero, rhettinger
Priority: low Keywords: patch

Created on 2019-10-01 11:56 by maggyero, last changed 2019-10-29 07:04 by rhettinger. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 16520 merged maggyero, 2019-10-01 11:57
Messages (3)
msg353685 - (view) Author: Géry (maggyero) * Date: 2019-10-01 11:56
The [language documentation](https://docs.python.org/3/reference/datamodel.html#invoking-descriptors) states:

> Data descriptors with __set__() and __get__() defined always override a redefinition in an instance dictionary. In contrast, non-data descriptors can be overridden by instances.

This override is not limited to data descriptors defining `__set__()` (and `__get__()`). It is also true for data descriptors defining `__delete__()` (and `__get__()`) and data descriptors defining both `__set__()` and `__delete__()` (and `__get__()`).

In other words, _any_ data descriptors (objects defining either `__set__()` or `__delete__()` or both) defining `__get__()` override an attribute redefinition in an instance dictionary.
msg353687 - (view) Author: Géry (maggyero) * Date: 2019-10-01 11:58
I have opened a PR here: https://github.com/python/cpython/pull/16520
msg355622 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-10-29 07:04
New changeset 4c155f738dc2e70ccb574f5169ad89c01753c6f7 by Raymond Hettinger (Géry Ogam) in branch 'master':
bpo-38336: Remove the __set__ method restriction on data descriptors for attribute lookup precedence (GH-16520)
https://github.com/python/cpython/commit/4c155f738dc2e70ccb574f5169ad89c01753c6f7
History
Date User Action Args
2019-10-29 07:04:33rhettingersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-10-29 07:04:07rhettingersetmessages: + msg355622
2019-10-28 21:52:39rhettingersetpriority: normal -> low
2019-10-28 21:47:48rhettingersetassignee: docs@python -> rhettinger
2019-10-28 16:24:43maggyerosetversions: + Python 3.8, - Python 3.7
2019-10-01 12:00:44maggyerosetnosy: + rhettinger
2019-10-01 11:58:11maggyerosetmessages: + msg353687
2019-10-01 11:57:03maggyerosetkeywords: + patch
stage: patch review
pull_requests: + pull_request16112
2019-10-01 11:56:31maggyerocreate