[issue40248] Proposed class for collections: dynamicdict

2020-04-10 Thread Steven D'Aprano
Steven D'Aprano 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 tic

[issue40248] Proposed class for collections: dynamicdict

2020-04-10 Thread Steele Farnsworth
Steele Farnsworth added the comment: Thank you, I have done so. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue40248] Proposed class for collections: dynamicdict

2020-04-10 Thread Eric V. Smith
Eric V. Smith added the comment: You probably want to bring this up on the python-ideas mailing list for discussion. Features like this typically get discussed there first. -- nosy: +eric.smith ___ Python tracker

[issue40248] Proposed class for collections: dynamicdict

2020-04-10 Thread Steele Farnsworth
New submission from Steele Farnsworth : I have implemented a class in the C code of the collections module which has similar behavior to the defaultdict class. This class, dynamicdict, supplies values for keys that have not yet been added using a default factory callable, but unlike defaultdi