Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Execute code in a namespace.

            def exec_(_code_, _globs_=None, _locs_=None):
        """Execute code in a namespace."""
        if _globs_ is None:
            frame = sys._getframe(1)
            _globs_ = frame.f_globals
            if _locs_ is None:
                _locs_ = frame.f_locals
            del frame
        elif _locs_ is None:
            _locs_ = _globs_
        exec("""exec _code_ in _globs_, _locs_""")
        


src/b/l/blaze-0.1/blaze/array.py   blaze(Download)
from .executive import simple_execute_write
from ._printing import array2string as _printer
from .py3help import exec_
from . import bmath
 
def inject_special(names):
    dct = {'bmath':bmath}
    for name in names:
        newname = '__%s__' % name
        exec_(_template.format(name=name), dct)