DEV Community

Discussion on: 8 Coolest Python Programming Language Features

Collapse
 
fronkan profile image
Fredrik Sjöstrand • Edited

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

Collapse
 
fronkan profile image
Fredrik Sjöstrand

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.