dates_dict[key] = dates_dict.get(key, []).append(date)
sets dates_dict[key]
to None
as list.append
returns None
.
In [5]: l = [1,2,3]
In [6]: var = l.append(3)
In [7]: print var
None
You should use collections.defaultdict
import collections
dates_dict = collections.defaultdict(list)