[IronPython] [IronPython 1.1] Scoping Advice(?)

Sanghyeon Seo sanxiyn at gmail.com
Sun Mar 16 02:57:53 CET 2008


2008/3/14, Leo Carbajal <desleo at gmail.com>:
> What I'm looking for is some advice as to how to tighten the scope of a
> module so that only the exposed hooks of my API are available. What I mean
> to say is, those API hooks are already visible, what bothers me is that I
> can type a couple of import statements into a script and do things like
> inspect the file system and manipulate those files, etc. After poking at the
> source I did something really inelegant, I made it so the parser did not
> recognize the import keyword, but I can't help but think there has to be a
> better way (as well as unseen consequences I haven't run into yet).

What you are describing is usually called "sandboxing", not "scoping".
Searching for "sandboxing Python" should give you some useful results.
Unfortunately, there is no simple and complete solution yet, as far as
I know.

Can you use .NET's application domain to isolate IronPython codes?

-- 
Seo Sanghyeon



More information about the Ironpython-users mailing list