Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
This feature is already provided by just supplying a `__missing__` dunder: py> class MyDict(dict): ... def __missing__(self, key): ... return "The key is {}".format(key) ... py> d = MyDict() py> d[1234] 'The key is 1234' I'm closing this ticket, but if the discussion on Python-Ideas reaches consensus that your class is necessary, feel free to re-open it. ---------- nosy: +steven.daprano resolution: -> out of date stage: -> resolved status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40248> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com