One-liner

14 June 2008 10:55

Sometimes list comprehensions seem to be the right way at every step, resulting in code like this:

return [z for x, y, z in sorted(
            [(len([j for j in scores if all(
                    [(f-e)*s>0 for (e, f, s) in zip(i, j, signs)]
            )]), random(), i) for i in scores])]

But since I did write a doctest for the function I don't feel too guilty!

Leave a comment