Code marshalling question.

sismex01 at hebmex.com sismex01 at hebmex.com
Tue Oct 8 10:50:07 EDT 2002


Hello all.

I've had this question for a while.  Is there a way to marshal
a segment of code into a string, which can then be transported
(via whatever method), such that the code segment can be
unmarshalled later and executed?

The reason for this is to create my own (I know, "It's already
been done", but this is a learning experience) marshalling and
unmarshalling module which will work with an HTTP server, so do
some kind of object or code repository.  The idea is not to have
locally the definitions of classes or functions I can request,
but to simply get a string, unmarshal and use.

Kinda like this:

>>> class SomeNiceObject:
>>>	...
>>>	...
>>>
>>> store(SomeNiceClass) -> marshals and sends to repository.

Elsewhere...

>>> sno = fetch("SomeNiceObject")
>>> instance = sno("some","arguments","maybe?")


Is this doable?  If so, how?

Thanks :-)

-gustavo













More information about the Python-list mailing list