merits of Lisp vs Python
Neil Cerutti
horpner at yahoo.com
Tue Dec 12 16:15:02 EST 2006
On 2006-12-12, André Thieme <address.good.until.2006.dec.22 at justmail.de> wrote:
>> Contrast the much more common
>>
>> a[i] = b[n]
>>
>> with
>>
>> (setf (aref a i) (aref b n))
>>
>> and the attractions of Python may make more sense.
>
> Here Python and Lisp are equal, 7 tokens vs 7 tokens, but in
> Python one has to write less since "[]" are 2 chars while
> "aref" are 4, plus the setf. But from counting the brain units
> which I regard as an important factor they are both equal.
A comparison of brain units of the above snippets is irrelevant,
since the snippets are not equivalent.
The Python snippet will work for any object a that provides
__setitem__ and any object b that provides __getitem__.
I don't know what an equivalent Lisp snippet would be (or even
exactly how close the above snippet comes to matching the Python
code), but whatever it is would be a better foundation for
comparing brain units with the above Python.
--
Neil Cerutti
More information about the Python-list
mailing list