classification
Title: Undocumented use of the term dictproxy in vars() documentation
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: berker.peksag, docs@python, martin.panter, mdk, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-03-12 22:23 by mdk, last changed 2016-06-24 06:11 by berker.peksag. This issue is now closed.

Files
File name Uploaded Description Edit
dictproxy.patch mdk, 2016-03-12 22:23 review
Messages (5)
msg261665 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2016-03-12 22:23
I spotted un undocumented term here : https://docs.python.org/3.5/library/functions.html#vars

in: "Objects such as modules and instances have an updateable __dict__ attribute; however, other objects may have write restrictions on their __dict__ attributes (for example, classes use a dictproxy to prevent direct dictionary updates)."

The term "dictproxy" is not documented anywhere in the documentation, I assume it's a https://docs.python.org/3.4/library/types.html#types.MappingProxyType, which is right:

    >>> class Foo():
    ...     pass
    ... 
    >>> vars(Foo)
    mappingproxy({'__doc__': None, '__weakref__': <attribute '__weakref__' of 'Foo' objects>, '__dict__': <attribute '__dict__' of 'Foo' objects>, '__module__': '__main__'})

So I propose a patch to link to it via a :class:`dictproxy <types.MappingProxyType>`.

Should we leave "dictproxy" or change it to "mappingproxy" ?
msg261670 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-03-13 05:28
I would add a space between "dict" and "proxy".
msg261686 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-03-13 07:56
In Python 2, the class was called “dictproxy”, the repr() used “dict_proxy” with an underscore, and it is exposed as types.DictProxyType. So I guess that is where the term comes from. In Python 3.3, Issue 14386 renamed the class and repr() to “mappingproxy”, and re-introduced it to types as MappingProxyType. (DictProxyType was previously removed in revision 15649aef2db5.)

So in Python 3 I would probably change it from “dictproxy” to a types.MappingProxyType link.
msg269161 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-24 06:11
New changeset 79e4593ce746 by Berker Peksag in branch '3.5':
Issue #26547: Remove outdated term dictproxy from vars() documentation
https://hg.python.org/cpython/rev/79e4593ce746

New changeset 45544b868f7b by Berker Peksag in branch 'default':
Issue #26547: Merge from 3.5
https://hg.python.org/cpython/rev/45544b868f7b
msg269162 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-24 06:11
Thanks, Julien.
History
Date User Action Args
2016-06-24 06:11:39berker.peksagsetstatus: open -> closed
resolution: fixed
messages: + msg269162

stage: patch review -> resolved
2016-06-24 06:11:04python-devsetnosy: + python-dev
messages: + msg269161
2016-06-23 03:30:24berker.peksagsetnosy: + berker.peksag
stage: patch review
type: enhancement -> behavior

versions: + Python 3.5, Python 3.6
2016-03-13 07:56:10martin.pantersetmessages: + msg261686
2016-03-13 05:28:19serhiy.storchakasetnosy: + serhiy.storchaka, martin.panter
messages: + msg261670
2016-03-12 22:23:24mdkcreate