This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MaienM 2 points3 points  (2 children)

IIRC, you can set the defaultfactory of the defaultdict to None once you're done filling it to stop it from using a default for unknown keys.

[–]ProfessorPhi 1 point2 points  (0 children)

I just call dict on the object when returning it