Python C extension providing... Python's own API?

Matimus mccredie at gmail.com
Mon Mar 26 22:55:38 CEST 2007


On Mar 26, 12:21 pm, "Adam Atlas" <a... at atlas.st> wrote:
> Does anyone know if it would be possible to create a CPython extension
> -- or use the ctypes module -- to access Python's own embedding API
> (http://docs.python.org/api/initialization.html&c.)? Could a Python
> program itself create a sub-interpreter, and work with it with all the
> privileges and capabilities that an actual C program would have?
>
> I realize that this may be a bit too... mystical? ... for a lot of
> people's tastes, but I'm just curious if it's possible. :)

I think that is what the "code" module is for. Maybe not exactly what
you were expecting, but the capability you describe is already there.
Being able to access its own interpreter is one of the things that
makes Python a  dynamic language.




More information about the Python-list mailing list