bokr at accessone.com
Thu Jul 12 09:58:39 CEST 2001
On Wed, 11 Jul 2001 23:52:59 -0400, "Tim Peters" <tim.one at home.com> wrote:
>The rub is that while this kind of thing is fun and easy to program in
>Python, it's a total pain in the ass to program in C, and indeed leads to
>code bloat. Since Python longs use base 2**15 internally, converting to
>power-of-2 bases is both simple and fast in C, so we settled for that.
That's interesting. Are you in effect saying there can't be compiled
python bytecode in python, even if there could be both speed and
space advantage for a given function?
So long as you weren't trying to lift yourself by not-yet-existent
boot straps, why not? That sounds a little funny, but ITYKWIM ;-)
BTW, looking at the way you can call the interpreter from C for embedding,
I would think you could write a translator for a useful subset of python
that would output a mix of plain C and Py_whatever calls to create C source
that could be compiled and linked into CPython. This would bypass the PITA
part and leave the fun part, ISTM ;-) Could you alter the byte code compiler
to emit this?
Done that way, strL wouldn't amount to that much C (or would it?), and you
could have 100% C code that way (i.e., not even byte codes as C constants
to feed the python interpreter).
More information about the Python-list