I was wondering if the one-block limit bothered anyone else. Maybe something like Haskell's where clause:
map(foo, pairs) where:
pairs = [(0,1), (20, 10), (30, 10)]
def foo(pair):
a = pair[1] * 2
b = pair[0] * a
return (b, a)
I'm not terribly familiar with Python's grammar, so it might be difficult to introduce a closing where-clause without ambiguity. In that case, it might be useful to use a do clause as well:
do:
<statements>
where:
<statements>
Another alternative would be to simply create a real function literal syntax (i.e., lambda that doesn't suck).
The only time I see where Python will adopt a lambda that doesn't suck, is the day when the community itself embraces functional programming. At the rate that is going and from what I've read from the commenters of the article. I don't think that's happening anytime soon.
I think that's right. Since the early days there have been lots of people willing to say (from an academic bent) how python is basically just scheme, and (from a practical bent) how the likes of python+libraries is good enough to make scheme unnecessary. Programming in scheme feels very different to scheme, largely because of the neutered lambda.