INNER CODE UNIT · Python

dot_python

probcomp/bayeslite · shell/src/core.py:370

    def dot_python(self, line):
        '''evaluate a Python expression
        <expression>

        Evaluate a Python expression in the underlying Python
        interpreter.

        `bdb' is bound to the BayesDB instance.

        Note that this command cannot execute a Python statement at
        the moment.  For that, use the `.pythexec` command.
        '''
        try:
            self._python_globals['bdb'] = self._bdb
            value = eval(line, self._python_globals)
            self.stdout.write('%s\n' % (repr(value),))
        except Exception:
            self.stdout.write(traceback.format_exc())

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…