merits of Lisp vs Python

Kirk Sluder kirk at nospam.jobsluder.net
Sat Dec 9 16:17:15 EST 2006


In article 
<pan.2006.12.09.17.24.37.237127 at REMOVE.THIS.cybersource.com.au>,
 Steven D'Aprano <steve at REMOVE.THIS.cybersource.com.au> wrote:
> Now, if you want to tell me that, despite all the talk, Lisp coders don't
> actually create new syntax or mini-languages all that often, that they
> just use macros as functions, then the question becomes: why do you need
> macros then if you are just using them as functions? Why not use functions?

Well, as a user of both lisp and python, it seems to me that python 
programs can create their own domain-specific mini-languages using 
mechanisms such as objects, classes and functions. It's quite 
possible to mask the bare-bones python behind functions and objects 
derived from imported libraries, which themselves might not be 
python-native.  And extreme advocates of functional programming 
raise the same arguments about objects: they create obfuscated 
constructs that are difficult to read and understand without 
unpacking their internals.  The questions could be asked, why do you 
need objects if you are just using them as containers for functions? 
Why not just use functions?

Python already is very explicit about supporting OOP, a paradigm 
that bundles functions and data into larger constructs. So why is it 
that many of these debates center around macros, which is another 
paradigm that bundles functions and data into larger constructs?  
Both objects and macros have IMO similar potential for abuse and 
obfuscation. 

But to answer your question, I use a macro when I have a problem 
that can't be easily reduced to a naive function. I also use object 
classes when I have a problem that can't be easily reduced to a 
simple data type.  When I don't need an macro or an object class, I 
just use naive functions and simple data types.



More information about the Python-list mailing list