You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2011-07-02.08:31:11.474>created_at=<Date2011-07-02.07:21:09.476>labels= ['invalid', 'type-bug', 'library']
title='factory func of collections.defaultdict should receive the "missing key" as args when called.'updated_at=<Date2011-07-02.08:31:11.467>user='https://bugs.python.org/lyricconch'
forexample:
defcalc(params):
""" i am factoring numbers. """# an expensive CPU cost function but # passin params and return result are both lightweightcachedcalc=collections.defaultdict(calc)
result=cachedcalc[0xFFFFFFFFFFFFFFFFFFF0AC0FFF1]
-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.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: