merits of Lisp vs Python
André Thieme
address.good.until.2006.dec.22 at justmail.de
Tue Dec 12 10:28:21 EST 2006
Paul Rubin schrieb:
> André Thieme <address.good.until.2006.dec.22 at justmail.de> writes:
>>> import module
>>> module.function = memoize(module.function)
>> Yes, I mentioned that a bit earlier in this thread (not about the
>> "during runtime" thing).
>> I also said that many macros only save some small bits of code.
>> Your python example contains 4 tokens / brain units.
>> The Lisp version only has 2.
>
> You shouldn't count the import statement, since you'd need the
> equivalent in Lisp as well.
I didn't count it.
1P) module.function
2P) =
3P) memoize(
4P) module.function)
vs
1L) (memoize
2L) function)
I counted 1P and 4P only as one (each) although it should have been 2
for each. But it would have worked too if we didn't need the "module.":
function = memoize(function).
> 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.
André
--
More information about the Python-list
mailing list