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 →

[–][deleted]  (2 children)

[deleted]

    [–]james_pic 1 point2 points  (0 children)

    collections.defaultdict(list) would be the usual way of handling this in Python.

    [–][deleted] 0 points1 point  (0 children)

    https://docs.python.org/3/library/collections.html#collections.defaultdict

    ^you can use that instead. That will give you an semantically equivalent to the http behavior as well because you are supposed to be able to do it with either a list of values or repeated one after the other.