Why is Python popular, while Lisp and Scheme aren't?
Carl Banks
imbosol at vt.edu
Sun Nov 10 21:57:55 EST 2002
Carl Banks wrote:
> Pascal Costanza wrote:
>> ...and so on. Now here is another nice macro.
>>
>> (defmacro apply-operators (op-list arg-list)
>> `(loop for op in ',op-list
>> do (format t " ~A: ~A~%" op (funcall op , at arg-list))))
>
[snip]
>
> I really don't think this is the best example for an advantage of Lisp
> syntax, if that's what you were trying to do, since it's trivial in
> Python also.
>
> def apply_operators(oplist,arglist)
> for op in oplist:
> print "%s: %s" % (op.__name__, reduce(op,arglist))
Before someone else notices, the Python example isn't the same: unlike
the Lisp version, it doesn't handle empty lists. That *isn't* trivial
to do in Python, and this kind of nicety of Lisp syntax probably does
come in handy once in awhile.
So, I retract my insinuation that it isn't a good example of an
advantage of Lisp syntax. (But I still say it should be a function.)
--
CARL BANKS
More information about the Python-list
mailing list