misc_by_id = {m["tid"]: m for m in miscs}
for m in miscs:
m["idxs"] = dict([(key, []) for key in idxs])
m["vals"] = dict([(key, []) for key in idxs])
for key in idxs:
assert len(idxs[key]) == len(vals[key])
After Change
misc_by_id = {m["tid"]: m for m in miscs}
for m in miscs:
m["idxs"] = {key: [] for key in idxs}
m["vals"] = {key: [] for key in idxs}
for key in idxs:
assert len(idxs[key]) == len(vals[key])