Evaluates a Python expression in the given context and returns the result. If `globals` is `None`, it defaults to Python module `__main__`. If `locals` is `None`, it defaults to the value of `globals`.
(
self,
code: &str,
globals: Option<&PyDict>,
locals: Option<&PyDict>,
)
| 250 | /// If `globals` is `None`, it defaults to Python module `__main__`. |
| 251 | /// If `locals` is `None`, it defaults to the value of `globals`. |
| 252 | pub fn eval( |
| 253 | self, |
| 254 | code: &str, |
| 255 | globals: Option<&PyDict>, |
| 256 | locals: Option<&PyDict>, |
| 257 | ) -> PyResult<PyObject> { |
| 258 | self.run_code(code, ffi::Py_eval_input, globals, locals) |
| 259 | } |
| 260 | |
| 261 | /// Executes one or more Python statements in the given context. |
| 262 | /// |