[Python-ideas] should `dict` supply a default `__missing__` implementation?
Ethan Furman
ethan at stoneleaf.us
Wed Jun 29 15:30:58 EDT 2016
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~
More information about the Python-ideas
mailing list