I just learned about this, so they are unreadable to me.
But it's not relevant. What relevant is, do they create a readability problem for a python developer who spent significant time with them? I honestly don't know.
But it's not relevant. What relevant is, do they create a readability problem for a python developer who spent significant time with them? I honestly don't know.
I am rather fond of dictionary comprehensions as mentioned in the article:
colors = [jedi['lightsaber_color'] for jedi in jedis]
frequencies = {color: colors.count(color) for color in set(colors)}
print(frequencies)
# {'green': 6, 'red': 5, 'blue': 6}Languages that support it directly on a list are much more intuitive in my head: list.filter().map()...
Alternatively, pull in syntax like elixir (and other languages) have to make chaining a breeze:
list |> map() |> filter()