Class Eval
- Known Subclasses:
-
Eval
Provide a very-safe environment for evaluating expressions
This class lets you overide operations, __power__, __mul__, __div__,
__mod__, __add__, __sub__, __getitem__, __lshift__, __rshift__, __and__,
__xor__, __or__,__pos__, __neg__, __not__, __repr__, __invert__, and
__getattr__.
For example, __mult__ might be overridden to prevent expressions
like:
'I like spam' * 100000000
or to disallow or limit attribute access.
| Method Summary |
| |
__init__(self,
expr,
globals)
Create a 'safe' expression
where:
expr -- a string containing the expression to be evaluated. |
| |
__call__(self,
**kw)
|
| |
eval(self,
mapping)
|
__init__(self,
expr,
globals={'__builtins__': {}, '__guarded_getslice__': <function de...)
(Constructor)
Create a 'safe' expression
where:
expr -- a string containing the expression to be evaluated.
globals -- A global namespace.
-
|