3 ms·
The list comprehension syntax is just set notation with Python keywords instead of symbols. Haskell, JavaScript, and Julia have similar syntax. It's also simila
by pseudalopex 8y ago
The list comprehension syntax is just set notation with Python keywords instead of symbols. Haskell, JavaScript, and Julia have similar syntax. It's also similar to the equivalent loop.
Which of these is clearer?
[x * y for x in S if P(x) > 0]
map(lambda x: x * y, filter(lambda x: P(x) > 0, S))