3 ms·
To be fair, we should be comparing like tokens, if the proof is using them as part of its advantage: evens = filter(lambda n: n % 2 == 0, numbers) with e
by thezilch 14y ago
To be fair, we should be comparing like tokens, if the proof is using them as part of its advantage:
evens = filter(lambda n: n % 2 == 0, numbers)
with
evens = [n for n in numbers if n % 2 == 0]
or
evens = [n for n in numbers if not n % 2]
Choosing token names is certainly a different
- Chris_Newton 14y agoFair comment. I suppose that’s why a more declarative style tends to work much better in a language designed for it. For example, functional programming languages tend to have neat syntactic sugar for things like simple lambda expressions or applying a series of transformations like the filter here, without introducing accidental complexity like extra identifiers that the reader than has to keep track of. The moment you’ve added that kind of baggage, which is almost inevitable to some degree in a language like Python, the clarity tends to suffer.