André Thieme wrote: > 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.
No, you do not understand. The Pythonista figured it out: a function would not do. > > 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. Omigod. Is that what you meant? You think macros are unnecessary because one could hard-code their expansions as separate functions? And that would constitute hiding the boilerplate? What happens when the boilerplate changes? <game over> ken -- Algebra: http://www.tilton-technology.com/LispNycAlgebra1.htm "Well, I've wrestled with reality for thirty-five years, Doctor, and I'm happy to state I finally won out over it." -- Elwood P. Dowd "I'll say I'm losing my grip, and it feels terrific." -- Smiling husband to scowling wife, New Yorker cartoon -- http://mail.python.org/mailman/listinfo/python-list