A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-March/117943.html below:

[Python-Dev] dictproxy for other mapping types than dict

[Python-Dev] dictproxy for other mapping types than dictVictor Stinner victor.stinner at gmail.com
Thu Mar 22 13:44:00 CET 2012
Hi,

I created the following issue to expose the dictproxy as a builtin type.
http://bugs.python.org/issue14386

I would be interesting to accept any mapping type, not only dict.
dictproxy implementation supports any mapping, even list or tuple, but
I don't want to support sequences because a missing key would raise an
IndexError instead of a KeyError.

My problem is to check the type in C. issubclass(collections.ChainMap,
collections.abc.Sequence) is False which is the expected result, so I
need to implement this check in C. "The "PyMapping_Check(dict) &&
!PyMapping_Check(dict)" fails on ChainMap: type.__new__(ChainMap)
fills tp_as_sequence->sq_item slot is defined because ChainMap has a
__getitem__ method.

Do you have an idea how to implement such test?

Victor
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4