I also saw the recent threads about Python removing
lambda
and map
. It's good that they're leaving, but only because they were crippled in the first place. I wrote some code recently that involved a callback that needed to just call a function and return True, but it expanded to four lines:def timeoutcb(): self.loadimage() return True gtk.timeout_add(1000, timeoutcb)because a Python's lambdas are "syntactically restricted to a single expression." Even Perl got this one right:
timeout 1000, sub { loadimage(); 1 }
.Both of these experiences let me down. I had expected this kind of unimaginativeness from Python (what's the distinction between statements and expressions anyway?), but I was pretty disappointed in Larry's answer, and the Perl 6 talk in general.
(...can you tell I'm writing Python code at work and getting cranky about it?)
* I say this with some sarcasm; I'm actually a fan of this. I like that experienced Perl programmers can say a lot with a little. We appreciate complexity in spoken language -- I can say "superfluous" even though a phrase like "unneeded extra" would do -- but we frown on the analogous thing in programming languages for "maintainability reasons". To me it makes no sense; it's like dumbing down the vocabulary in a book just because you expect your readers to not be able to understand it, despite the book itself being about a very complicated subject.