Package gmisclib :: Module g2_select :: Class selector_c
[frames] | no frames]

Class selector_c

source code


Instance Methods
 
__init__(self, code, global_values=None)
Code = a string containing python code.
source code
 
set_code(self, code) source code
 
set_trap(self, exc, result)
This adds to a list of exceptions.
source code
 
eval(self, locals) source code
 
globals(self, s) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, code, global_values=None)
(Constructor)

source code 

Code = a string containing python code. Global_values = a dictionary containing values to be used by that python code. Note that the dictionary is not copied, so that it is shared and changes will be noticed.

Overrides: object.__init__

set_trap(self, exc, result)

source code 

This adds to a list of exceptions. If any of those exceptions happen later, when you run self.eval(), then they will be caught and turned into the specified result.

For instance, if you call set_trap(ValueError, False), and when you execute self.cc in self.eval a ValueError is raised, then self.eval() will return False. You have mapped a ValueError exception into a returned value of False.