Title: Documentation of descriptors needs more detail
Type: Stage:
Components: Documentation Versions: Python 2.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, lpd
Priority: normal Keywords:

Created on 2007-07-23 05:35 by lpd, last changed 2007-08-23 21:43 by georg.brandl. This issue is now closed.

Messages (2)
msg32541 - (view) Author: L. Peter Deutsch (lpd) Date: 2007-07-23 05:35
Doc section says:

Data descriptors define both __get__() and __set__(). Non-data descriptors have just the __get__() method.

This is not quite detailed enough. By experiment, the next paragraph is the whole story, which I think should replace the above two sentences.

A descriptor can define any combination of __get__(), __set__(), and __delete__(). If it does not define __get__(), then accessing the attribute (a.x) will return the descriptor itself. If the descriptor defines __set__() and/or __delete__(), it is a data descriptor; if it defines neither, it is a non-data descriptor.

I realize that some combinations of __get__(), __set__(), and __delete__() are not very useful, but the documentation should cover all the cases.
msg55225 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-08-23 21:43
Added a footnote in rev. 57355.
Date User Action Args
2007-08-23 21:43:03georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg55225
nosy: + georg.brandl
2007-07-23 05:35:32lpdcreate