Philip Smith wrote: > I've read with interest the continuing debate about 'lambda' and its place > in Python. > > Just to say that personally I think its an elegant and useful construct for > many types of programming task (particularly number theory/artificial
> intelligence/genetic algorithms) Well, I've done genetic algorithms in Python, and my implementation didn't use lambda (other possibly than the occasional and convenient passing an anonymous function as an argument). If nothing else, my experience proves GA can be done without lambda. Most algorithms can be tackled effectively and elegantly by different programing paradigms. When someone says, "lambda is useful for this," often the thruth is "lambda is useful for this _if you are using a heavily functional style_." Often, someone else could implement the same algoithm just as effectively without it. For example, me doing genetic algorithms without it. Which brings us to my point: If you're looking for a language that supports a heavily functional style, Python just isn't it. The functional elements that are in Python are not there to support heavily functional programming; they are there to enhance and complement the procedural/iterative style. Does lambda do that? In my opinion, not much. I never thought it was crucial, and now that Python has added support more specific (i.e., more specifically useful for enhancing procedural code) functional features, like generator expressions, lambda is less useful than ever. I'd say it's dispensible and not worth the added complexity. [snip] > For that matter I would find implementing the classical algorithms far > easier if python had 'goto' (I'll wait for the guffaws to subside before > mentioning that no lesser guru than Donald Knuth writes his algorithms that > way - naturally so because it reflects what the machine does at the base > level). I wonder if anyone can come up with a better argument than a certain isolated retrospectively bad decision Knuth made? I'm curous whether you have a use case for goto, in Python, that can't be handled with try...finally or exception handling. We already know about "the break from multiple loops" one; it's not terribly common to do that and you can handle it with an exception. (Ok, I'm actually not curious, cause I'm pretty sure you don't.) [snip] > Competition: Has anyone found anything you can't do in the language? Mr. Turing is rolling in his grave.... -- CARL BANKS -- http://mail.python.org/mailman/listinfo/python-list