What python can NOT do?
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Mon Sep 7 22:49:28 EDT 2009
On Tue, 08 Sep 2009 00:09:26 +0000, Albert van der Horst wrote:
>>Existing Python implementations don't give you direct access to
>>hardware, and bit-manipulation has a lot of overhead in Python.
>>Numerical
>
> Surely you don't mean that
> 0x17 & 0xAD
> has more overhead than
> 17 + 123
> So what do you mean here?
What I mean is that bit-manipulation in low-level languages like C is
very close to the metal, and hence very efficient. In Python, *all*
operations (including bit-manipulation and arithmetic) has the overhead
of the Python virtual machine. You won't notice the difference if you're
just ANDing a handful of numbers, but if you're doing millions of them
(say, you're doing industrial-strength encryption) you certainly will.
--
Steven
More information about the Python-list
mailing list