If defaultdict does not find the key, it calls the function without any parameters. FROM
def hi(name):
return "hi " + name
a = defaultdict(hi)
a["hello"]
hi , , . hi - , , hi(), .. TypeError, .
( )
def hi(name):
return "hi " + name
def make_hi():
return hi
a = defaultdict(make_hi)
print(a["hello"]("jane"))
a["hello"] make_hi, hi, ("jane").