Python assembler

Steve Holden sholden at holdenweb.com
Wed Mar 28 19:29:03 CEST 2001


"Eddie and Babs" <kca17 at dial.pipex.com> wrote in message
news:3ac20dcc$0$15028$cc9e4d1f at news.dial.pipex.com...
> The Python library reference says of the 'dis' module: "Since there is no
> Python assembler, this module defines the Python assembly language."
>
> Is the lack of a Python bytecode assembler a deliberate policy decision or
> is it just that nobody has written one yet? Or have many tried, but none
> lived to tell the tale?
>
> I would consider such an assembler if there were no obvious reasons for it
> not to exist.

Probably the main reason is that to assemble the bytecodes you would
probably end up converting most of them into calls on the interpreter API,
and most of the interpreter would have to be loaded to support everything
one might possibly do in Python (eval, exec, etc.).

Since the interpreter's inner loop (fetch a byte code, execute it) is fairly
tightly coded, there would be little advantage to compiling.

regards
 Steve






More information about the Python-list mailing list