Mailing List Archive

[issue14386] Expose dict_proxy internal type as types.MappingProxyType
Changes by STINNER Victor <victor.stinner@gmail.com>:


----------
title: Expose dict_proxy internal type as types.MappingViewType -> Expose dict_proxy internal type as types.MappingProxyType

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue14386] Expose dict_proxy internal type as types.MappingProxyType [ In reply to ]
Raymond Hettinger <raymond.hettinger@gmail.com> added the comment:

[Victor]
'''Oh, collections.abc contains also the mappingview type exposed with the name "dict_proxy": dict_proxy = type(type.__dict__)

It was exposed as _abcoll.dict_proxy in Python 3.2.
It is not documented. Should we keep it for backward compatibility, or can it be removed? _abcoll was a private module and I didn't find dict_proxy in Python 3.2 doc.
'''

You can ignore those. As you saw, these are undocumented and not listed in __all__. If we ever expose these, it will likely be through the types module (or less likely through the collections.abc module which is public in 3.3). Probably, they won't get exposed at all because they are awkward to access directly and because they have implementation specific details (i.e. other implementations have their choice of how to implement various iterators and whatnot).

----------

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue14386] Expose dict_proxy internal type as types.MappingProxyType [ In reply to ]
STINNER Victor <victor.stinner@gmail.com> added the comment:

> You can ignore those.

You mean that I can remove it?

It's a little bit surprising to find a concrete class in collections.abc. So I think that it's better to expose dict_proxy in types than in collections.abc.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue14386] Expose dict_proxy internal type as types.MappingProxyType [ In reply to ]
Raymond Hettinger <raymond.hettinger@gmail.com> added the comment:

[Victor]
> You mean that I can remove it?

No, it needs to stay there.
Those concrete types aren't exposed to users
but they are used inside to collections.abcs
to register the types so that isinstance()
will work as expected.

Summary: The collections.abc module is fine as-is.

Go ahead and add dictproxy to the types module.
Expose it there and document it there.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue14386] Expose dict_proxy internal type as types.MappingProxyType [ In reply to ]
Roundup Robot <devnull@psf.upfronthosting.co.za> added the comment:

New changeset c3a0197256ee by Victor Stinner in branch 'default':
Issue #14386: Expose the dict_proxy internal type as types.MappingProxyType
http://hg.python.org/cpython/rev/c3a0197256ee

----------
nosy: +python-dev

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue14386] Expose dict_proxy internal type as types.MappingProxyType [ In reply to ]
STINNER Victor <victor.stinner@gmail.com> added the comment:

> Summary: The collections.abc module is fine as-is.

Ok, but there is still an issue: issubclass(types.MappingProxyType, collections.abc.Mapping) is False. Attached registers MappingProxyType as a Mapping. Is it correct?

The patch also renames dict_proxy to mappingproxy. Is it backward incompatible? (collections.abc module was added to Python 3.3)

----------
Added file: http://bugs.python.org/file25229/mappingproxy_abc.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue14386] Expose dict_proxy internal type as types.MappingProxyType [ In reply to ]
Roundup Robot <devnull@psf.upfronthosting.co.za> added the comment:

New changeset 34af3e74292d by Victor Stinner in branch 'default':
Close #14386: Register types.MappingProxyType as a Mapping
http://hg.python.org/cpython/rev/34af3e74292d

----------
resolution: -> fixed
stage: -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com