What's better about Ruby than Python?

Roy Smith roy at panix.com
Thu Aug 21 21:44:59 EDT 2003


trimtab at mac.com (Olivier Drolet) wrote:
> Common Lisp macros can often significantly improve code readability by
> merely reducing the amount of code.

If what you're talking about is basicly refactoring, then it seems like 
you could get the same code reduction by defining new functions/methods.  
What does a macro give you that a function doesn't?

In C, the answer was "faster code", which I claim is simple a non-issue 
for Python (we're not after speed in the same way C guys are).

In C++ the answer seems to be "generic programming", in the sense that 
templates let you factor out the data type from the algorithm.  Again, a 
non-issue in a dynamic language like Python, where type information is 
carried in the object, not the container.

So, is there something else that macros buy you that I'm not seeing?  
People keep talking about how lisp macros are nothing like C/C++ macros.  
OK, I'm willing to be educated.  How are they different?  Can somebody 
give an example?  Keep in mind that the last time I did any serious lisp 
was about 20 years ago.




More information about the Python-list mailing list