
29 Jun
2018
29 Jun
'18
2:30 a.m.
I think you accidentally swapped variables there: student_school_list vs student_by_school
Oops, yeah. That’s what I get for whipping out a message before catching a bus.
(And on a phone now)
But maybe you could wrap the defaultdict constructor around a generator expression that transforms the list first.
That would get the keys right. Though still not call append for you.
So maybe a solution is an accumulator special case of defaultdict — it uses a list be default and appends by default.
Almost like counter...
-CHB