[issue12473] factory func of collections.defaultdict should receive the "missing key" as args when called.
Amaury Forgeot d'Arc
report at bugs.python.org
Sat Jul 2 10:31:12 CEST 2011
Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:
-1. Besides compatibility issues, defaultdict is a dict: it contains data, and is not meant to consume CPU when accessing items. Its "default" function should return initial values, like 0 or an empty list.
I think what you want is "memoization"; a memoized function still looks like a function! there are many implementations for python, one of these is here: http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize
----------
nosy: +amaury.forgeotdarc
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12473>
_______________________________________
More information about the Python-bugs-list
mailing list