Code marshalling question.

Michael Hudson mwh at python.net
Tue Oct 8 11:17:30 EDT 2002


sismex01 at hebmex.com writes:

> 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?

Uh, module "marshal"?

> 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.

You'll need to do some more work here, but marshal can get you a fair
way.

> Is this doable?  If so, how?

Could also look at e.g. pyro.

Cheers,
M.

-- 
59. In English every word can be verbed. Would that it were so in
    our programming languages.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list