On this page
  1. eval
  2. Import & Availability
  3. Overview & Signature
  4. Usage
  5. Gotchas
  6. REPL Inspect

eval

Prev: enumerate | Up: __builtins__ | Next: exec
Rel: breakpoint, compile, exec, globals, input
Ref: docs.python.org — eval
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import eval

Overview & Signature

eval(source, /, globals=None, locals=None)

Evaluate the given source in the context of globals and locals.

Usage

assert eval("3 * (4 + 5)", {"__builtins__": {}}, {}) == 27

Gotchas

REPL Inspect

help(eval)

Linked from

Related notes