Desactivating Python keywords and built-in functions

dataangel k04jg02 at
Fri Oct 8 21:27:03 CEST 2004

Andr? Roberge wrote:

>In short:
>Is there a simple way to desactivate Python keywords and built-in
>keywords [e.g. eval()]
>Longer description:
>I want to use a subset of Python as an embedded language and don't
>want the users to have access to the rest of the language.   One
>approach I thought of using would be something along the following
>read in the script for the user;
>scan for "forbidden" keywords or expression;
>if found, give an error message and stop;
>otherwise, let Python interpret the code.
>Before I jump and start coding, I thought I would ask people that know
>more about these things than me
>(which means probably 97.2% of the readership of comp.lang.python  ;-)
This doesn't exactly qualify as simple, but depending on how modular the 
source is, it might be possible to simply comment them out and recompile.

There ought to be some way of doing this, I'd love to see a Python 
interface to Robocode :D

More information about the Python-list mailing list