Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Ask HN: Good Python codebases to read?. Parent comment
>>> [(b, a) for a, b in sorted(((-(x2), x) for x in xrange(10) if 0 == x % 2))]
[(8, -64), (6, -36), (4, -16), (2, -4), (0, 0)]
However, ocasionally you still need a more complex sorting function. So lambdas are still handy, IMO.
There are no comments on this comment yet.
>>> [(b, a) for a, b in sorted(((-(x2), x) for x in xrange(10) if 0 == x % 2))]
[(8, -64), (6, -36), (4, -16), (2, -4), (0, 0)]
However, ocasionally you still need a more complex sorting function. So lambdas are still handy, IMO.