merits of Lisp vs Python
André Thieme
address.good.until.2006.dec.22 at justmail.de
Sat Dec 9 19:28:36 EST 2006
Ken Tilton schrieb:
> The last time we went thru this a Pythonista finally said, Oh, I get it.
> These five lines of code I have to write all the time (two setup, one
> func call, two cleanup) can be collapsed into one or two. The thread
> will be hard to miss in Google groups (two years back?) and the epiphany
> appears right at the end of the thread. <hint>
Functional programming is the solution here, not Lisp.
You could make that with a new function (in Python), that takes a
function (and its args, don't remember the correct syntax).
def foo(function, args):
setup(1)
setup(2)
function(args)
cleanup(1)
cleanup(2)
The nice thing in Lisp would now be to save a lambda with the macro.
In Python one would fill the name space with throw away functions that
get called only one time.
André
--
More information about the Python-list
mailing list