Request for help: arbitrary user code

KevinL darius at
Tue Dec 5 03:49:52 CET 2000

I've been working on a program for a while that executes arbitrary 
user-provided code, and I'm trying to setup a secure, reasonably fast way of 
doing such.  The code is generally provided as functions which are compiled 
and executed multiple times in a sort of fake-binding to various objects.

I'm running into a problem with the way python handles namespaces for said 
functions - that it binds them at function compilation rather than at function 
call, and that they must be dictionaries.  My first response was that 
immutable dictionaries would solve the problem - the other possibility I've 
come up with recently is that being able to change func.func_globals on the 
fly would also solve this.

Anyway, I was hoping to get some comments from better minds than my own, so 
I've setup a zope wiki page explaining the problem I'm having - it's at

I'd love to solve this problem - without a good solution, it is starting to 
look like python just isn't suited for providing a multi-user scripting 
platform, which would be depressing, as in most other ways it's near-perfect...
This one problem is prooving intractable for me, tho :(.


More information about the Python-list mailing list