dynamically generating a module

Hung Jung Lu hungjunglu at yahoo.com
Tue Nov 13 17:59:44 EST 2001


Hi,

Python does have good dynamic features. You can add/remove objects,
classes, methods, etc. dynamically.

Here is one more challenge: is it possible to create a module on the
fly?

Suppose I have the ASCII Python source code of a module-to-be, or even
better, suppose that I have the compiled byte code of a module-to-be,
stored in a Python string. Is there a simple way (meaning not tweaking
at C++ level) of making the module-to-be into a real module, without
hitting the harddrive?

thanks,

Hung Jung



More information about the Python-list mailing list