merits of Lisp vs Python
André Thieme
address.good.until.2006.dec.22 at justmail.de
Sat Dec 9 19:53:50 EST 2006
More information about the Python-list mailing list
Sat Dec 9 19:53:50 EST 2006
- Previous message (by thread): merits of Lisp vs Python
- Next message (by thread): merits of Lisp vs Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ken Tilton schrieb: > > > 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. What do you mean? >> 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> Well, macros are unnecessary from a mathematical point of view: 0 and 1 are enough. But of course they have the potential to be a real time saver. What I want to say is: the situation you gave as an example is not the place where macros shine, because 1st class functions can take over. You could maybe give another example: how would one realize something like (memoize function) in Python? Or (defmethod name :after ..)? André --
- Previous message (by thread): merits of Lisp vs Python
- Next message (by thread): merits of Lisp vs Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list