<div dir="ltr">But neither UserDict nor MutableMapping defines __missing__ ?  What is a subclasser supposed to do?<br><br>On Wednesday, June 29, 2016 at 4:59:03 PM UTC-4, Guido van Rossum wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">UserDict is superseded by MutableMapping.
<br>
<br>I don't think we should make dict a kitchen sink class. I also don't
<br>think we should particularly encourage subclassing it. So -1 on adding
<br>dict.__missing__.
<br>
<br>On Wed, Jun 29, 2016 at 12:30 PM, Ethan Furman <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="KX7BhAw6CwAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">et...@stoneleaf.us</a>> wrote:
<br>> On 06/29/2016 12:09 PM, Guido van Rossum wrote:
<br>>
<br>>> So providing the comprehensive base class is up to the user, not up to
<br>>> the stdlib. Is that such a big deal?
<br>>
<br>>
<br>> No, it's not.  But it makes for a better user experience if the base class
<br>> has the __missing__ method that raises a KeyError already.
<br>>
<br>> Didn't we add a UserDict that could be subclassed primarily because
<br>> subclassing dict directly was such a poor user experience?
<br>>
<br>> If adding __missing__ to dict is huge (performance hit?), we don't do it.
<br>> If it's not, I think we should.  Maybe add it to UserDict if performance is
<br>> a concern?
<br>>
<br>>
<br>> --
<br>> ~Ethan~
<br>> ______________________________<wbr>_________________
<br>> Python-ideas mailing list
<br>> <a href="javascript:" target="_blank" gdf-obfuscated-mailto="KX7BhAw6CwAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">Python...@python.org</a>
<br>> <a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFj1EaNHnVmh20FnFPoUi4J-MpfQw';return true;" onclick="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFj1EaNHnVmh20FnFPoUi4J-MpfQw';return true;">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a>
<br>> Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJOrArSUDKkjrnthO6_CznMzkPsA';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJOrArSUDKkjrnthO6_CznMzkPsA';return true;">http://python.org/psf/<wbr>codeofconduct/</a>
<br>
<br>
<br>
<br>-- 
<br>--Guido van Rossum (<a href="http://python.org/~guido" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2F~guido\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGKI5lSgzXFUM7Y5HtkFAp6sQAxEg';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2F~guido\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGKI5lSgzXFUM7Y5HtkFAp6sQAxEg';return true;">python.org/~guido</a>)
<br>______________________________<wbr>_________________
<br>Python-ideas mailing list
<br><a href="javascript:" target="_blank" gdf-obfuscated-mailto="KX7BhAw6CwAJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">Python...@python.org</a>
<br><a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank" rel="nofollow" onmousedown="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFj1EaNHnVmh20FnFPoUi4J-MpfQw';return true;" onclick="this.href='https://www.google.com/url?q\x3dhttps%3A%2F%2Fmail.python.org%2Fmailman%2Flistinfo%2Fpython-ideas\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFj1EaNHnVmh20FnFPoUi4J-MpfQw';return true;">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a>
<br>Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJOrArSUDKkjrnthO6_CznMzkPsA';return true;" onclick="this.href='http://www.google.com/url?q\x3dhttp%3A%2F%2Fpython.org%2Fpsf%2Fcodeofconduct%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHJOrArSUDKkjrnthO6_CznMzkPsA';return true;">http://python.org/psf/<wbr>codeofconduct/</a>
<br></blockquote></div>