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.
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.