Desactivating Python keywords and built-in functions

Jeremy Bowers jerf at jerf.org
Fri Oct 8 13:53:24 EDT 2004


On Fri, 08 Oct 2004 07:45:12 -0700, 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
> lines:

Others have commented that many others have tried this and not succeeded.

Maybe another tack: Is there a specific reason that you don't want people
using "eval"? Some specific object you don't want used, some specific
capability invoked? Maybe the root problem can be addressed in another way.

If it is just to prevent them from confusing themselves, I'd suggest the
"don't document it" solution :-)



More information about the Python-list mailing list