[issue14386] Expose dictproxy as a public type

Jim Jewett report at bugs.python.org
Fri Mar 23 06:04:41 CET 2012


Jim Jewett <jimjjewett at gmail.com> added the comment:

> The problem is to reject sequence in dictproxy constructor.

Why?  Just because you can't delegate in quite the same way?  A sequence *does* meet the (immutable) Mapping interface; it just won't happen to have any non-integer keys.

Or are you worried about IndexError vs KeyError?  Personally, I would just document it as returning LookupError, but if you're really worried, you could always catch the IndexError and raise a KeyError from it.

> The "PyMapping_Check(dict) && !PyMapping_Check(dict)" 

I'm not seeing how anything could sanely pass that ... was there a typo when pasting?

----------
nosy: +Jim.Jewett

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14386>
_______________________________________


More information about the Python-bugs-list mailing list