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
dict.__missing__.
On Wed, Jun 29, 2016 at 12:30 PM, Ethan Furman <et...@stoneleaf.us> wrote:
> 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 class
> 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 it.
> If it's not, I think we should. Maybe add it to UserDict if performance is
> a concern?
>
>
> --
> ~Ethan~
> _______________________________________________
> Python-ideas mailing list
> Python...@python.org
> 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
Python...@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/