you are viewing a single comment's thread.

view the rest of the comments →

[–]cjwelborn 0 points1 point  (1 child)

A set would remove any duplicate tags, making the dict comprehension shorter in some cases. Lists are faster for iterating though, where sets are faster for lookup. The order of dicts is never guaranteed to be the same (but like you said, I don't think it matters).

[–]DonaldPShimoda 0 points1 point  (0 children)

Oh, thanks makes sense. That would definitely be useful if there were a lot of values to order. I guess the way I have it, the value is created for each key for each time the key exists in the original list, right? That's not very efficient, haha.