Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/python/cpython
/ default_factory
Method
default_factory
Lib/test/test_defaultdict.py:193–199 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
191
count = 0
192
193
def
default_factory():
194
nonlocal count
195
count += 1
196
local_count = count
197
if
count == 1:
198
test_dict[key]
199
return
local_count
200
201
test_dict = defaultdict(default_factory)
202
Callers
1
freeze
Method · 0.80
Calls
no outgoing calls
Tested by
no test coverage detected