merits of Lisp vs Python
Andrew Reilly
andrew-newspost at areilly.bpc-users.org
Tue Dec 12 00:28:02 EST 2006
On Tue, 12 Dec 2006 16:35:48 +1300, greg wrote:
> When a Lisp compiler sees
>
> (setq c (+ a b))
>
> it can reasonably infer that the + is the built-in numeric
> addition operator. But a Python compiler seeing
>
> c = a + b
>
> can't tell *anything* about what the + means without
> knowing the types of a and b. They might be numbers, or
> strings, or lists, or some user-defined class with its
> own definition of addition.
That may be true, but lisp's numeric addition operator knows how to add
fixnums, bignums, rationals and whatever the lisp name for floating points
is (imprecise?) -- something that not many (if any) processor instruction
sets can manage. So that's still type-dependent dispatch, which isn't
going to get us to the speeds that we actually see reported unless there's
extra stuff going on. Type inference? Declarations?
Cheers,
--
Andrew
More information about the Python-list
mailing list