Don't try to fake anonymous functions in Python. Use its strengths: decorators, generators, etc.
Anonymous functions work well (err, passably) in JavaScript and Perl. They don't really work in Python, and of course you'll just run into pain if you try to force them to.
The Python package lambdex [1] provides a way to write multi-line anonymous functions in Python, with a syntax that's close enough to the "normal" Python.
Nice article, though I already understood the matter. Thanks for the link to PEP 463[1], though; I can see it cleaning up some of our code. Do you know if there have been any developments into implementing it?
Neat, but you should check out PEP 8 at some point. An empty line between a decorator and the decorated function (flask) is confusing, and whitespace in keyword arguments just looks off.
This is certainly an interesting idea. A quick Google search gave me this toy example: [1][2]
Of course making it work for all cases would be very hard due to the excessive dynamism of Python, but for simple arithmetic operations it could be made to work fairly well.
Anonymous functions work well (err, passably) in JavaScript and Perl. They don't really work in Python, and of course you'll just run into pain if you try to force them to.
Perhaps also make some noise about this PEP: http://legacy.python.org/dev/peps/pep-0403/
reply