Can python do this?

Paul Winkler slinkp23 at yahoo.com
Mon Nov 19 16:40:23 EST 2001


On Mon, 19 Nov 2001 13:16:57 -0800, Ken <khirmint at hotmail.com> wrote:
>Is it possible to have a program running (either C or Python) and have
>that program dynamically load Python functions while its executing?

Sure. You can import functions from modules at any time, and you can
reload a module any time you want.

Zope does a lot of dynamic code stuff. For example, what Zope refers
to as a "Script (Python)" is actually an object that lives in the ZODB
(an object database written in python); this object contains the text
of a python function. You can create these "Scripts" at any time, and
start using them as soon as they're created. No need for a server
restart.

If you do a lot of this kind of thing and don't want to use Zope as
your server, you might look into running ZODB as a standalone database
without Zope. There are docs about that somewhere at
zope.org... sorry, I've never tried it.

--PW



More information about the Python-list mailing list