Package ComboCode :: Package cc :: Package ivs :: Package sigproc :: Package lmfit :: Module asteval
[hide private]
[frames] | no frames]

Module asteval

source code

Safe(ish) evaluator of python expressions, using ast module. The emphasis here is on mathematical expressions, and so numpy functions are imported if available and used.

Symbols are held in the Interpreter symtable -- a simple dictionary supporting a simple, flat namespace.

Expressions can be compiled into ast node and then evaluated later, using the current values in the


Version: 0.3.1

Classes [hide private]
  Empty
basic empty containter
  Interpreter
mathematical expression compiler and interpreter.
  Procedure
Procedure: user-defined function for asteval
Functions [hide private]
 
op2func(op)
return function for operator nodes
source code
Variables [hide private]
  HAS_NUMPY = True
  OPERATORS = {ast.Add: lambda a, b: b.__radd__(a) if isParamete...
  ReturnedNone = Empty()
  __package__ = 'ComboCode.cc.ivs.sigproc.lmfit'
Variables Details [hide private]

OPERATORS

Value:
{ast.Add: lambda a, b: b.__radd__(a) if isParameter(b) else a+ b, ast.\
Sub: lambda a, b: b.__rsub__(a) if isParameter(b) else a-b, ast.Mult: \
lambda a, b: b.__rmul__(a) if isParameter(b) else a* b, ast.Div: lambd\
a a, b: b.__rdiv__(a) if isParameter(b) else a/ b, ast.FloorDiv: lambd\
a a, b: b.__rfloordiv__(a) if isParameter(b) else a// b, ast.Mod: lamb\
da a, b: b.__rmod__(a) if isParameter(b) else a % b, ast.Pow: lambda a\
, b: b.__rpow__(a) if isParameter(b) else a** b, ast.Eq: lambda a, b: \
b.__eq__(a) if isParameter(b) else a== b, ast.Gt: lambda a, b: b.__le_\
...