4 ms·
I love Norvig's Python posts. He really gets the spirit of the language and has fun with it.
by blt 13y ago
I love Norvig's Python posts. He really gets the spirit of the language and has fun with it.
- mkesper 13y agoYes, I love expressions as this one: winners, losers = (winners - losers), (losers - winners)
- echion 13y agoWas that in an earlier version? I can't find that in the article now.
- mikeash 13y agoYep, he originally threw out all names that appeared on both lists, while he's now arbitrarily assigning them to the winners' set. Not sure about the reasoning behind the change, but there it is. The quoted line computed new winning and losing sets that excluded all commonalities.
- e12e 13y agoI actually also really liked that line, it helped flesh the article out to be an impromptu tutorial on using sets in python (which it still is, to a certain extent). I remember reading that sets overloaded some sensible operators a while back, but I really appreciated this reminder. In other words, very nice of you to highlight it in a comment, as new readers wouldn't have seen it otherwise (as it turns out).
- BWStearns 13y agoMost times when I read Norvig's Python I get the same feeling as when a tough riddle answer is given, except with Norvig you don't wonder whether anyone actually arrives at the answer the first time they hear it, you know he did.