Thanks for a nice post. I had never heard about the chaining comparison. I love it!
A note on the dictionary compression. If you just want to combine to lists to a dictionary you could also use:
dict(zip(list1,list2))
Where I think the dictionary compression really shines is if you need to do some filtering when creating the dictionary
I also use dictionary compressions when mapping from a 2D arrays where I want the key to be the value of one of the columns.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for a nice post. I had never heard about the chaining comparison. I love it!
A note on the dictionary compression.
If you just want to combine to lists to a dictionary you could also use:
Where I think the dictionary compression really shines is if you need to do some filtering when creating the dictionary
I also use dictionary compressions when mapping from a 2D arrays where I want the key to be the value of one of the columns.