[Python-ideas] should `dict` supply a default `__missing__` implementation?
mistersheik at gmail.com
Tue Jul 5 15:18:00 EDT 2016
But neither UserDict nor MutableMapping defines __missing__ ? What is a
subclasser supposed to do?
On Wednesday, June 29, 2016 at 4:59:03 PM UTC-4, Guido van Rossum wrote:
> UserDict is superseded by MutableMapping.
> I don't think we should make dict a kitchen sink class. I also don't
> think we should particularly encourage subclassing it. So -1 on adding
> On Wed, Jun 29, 2016 at 12:30 PM, Ethan Furman <et... at stoneleaf.us
> > On 06/29/2016 12:09 PM, Guido van Rossum wrote:
> >> So providing the comprehensive base class is up to the user, not up to
> >> the stdlib. Is that such a big deal?
> > No, it's not. But it makes for a better user experience if the base
> > has the __missing__ method that raises a KeyError already.
> > Didn't we add a UserDict that could be subclassed primarily because
> > subclassing dict directly was such a poor user experience?
> > If adding __missing__ to dict is huge (performance hit?), we don't do
> > If it's not, I think we should. Maybe add it to UserDict if performance
> > a concern?
> > --
> > ~Ethan~
> > _______________________________________________
> > Python-ideas mailing list
> > https://mail.python.org/mailman/listinfo/python-ideas
> > Code of Conduct: http://python.org/psf/codeofconduct/
> --Guido van Rossum (python.org/~guido)
> Python-ideas mailing list
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas