Why a class when there will only be one instance?

Vineet Jain vineet at eswap.com
Thu May 27 19:49:39 EDT 2004


> Just keep track of the state you want to preserve and
> you want to re-initialise, and then call the different parts
> from outside. Easy.

If I went with just functions and not classes then I could pass 
a variable (class instance) which can be used by users to store some 
state information between calls. I would also use the same variable to 
expose global variables.
ute all code of the module

> but I would probably write my own evaluator for this,
> not importing the module directly, but compiling its code
> once, and then execute the code, give them special globals
> with custom builtins, to protect you from non-programmers.

How would you write a custom evaluator? 
Is the evaluator that comes with python written in c?
How difficult would it be?
How can I restrict the code that the user can run so that he can write
only to his sub directory and that he does not crash the system somehow?

Thanks for your help.

Vineet





More information about the Python-list mailing list