On this page
codeop.CommandCompiler
Up: codeop | Next: codeop.Compile
Rel: codeop.Compile, codeop.compile_command
Ref: docs.python.org — codeop.CommandCompiler
Tags: #public #python3 #stdlib #codeop
Import
import codeop
from codeop import CommandCompiler
Signature & Overview
codeop.CommandCompiler()
Instances of this class have call methods identical in signature to compile_command; the difference is that if the instance compiles program text containing a future statement,
Usage
import codeop
cc = codeop.CommandCompiler()
assert cc("x = 1 + 2") is not None
assert cc("def f():") is None
Gotchas
- Remembers
from __future__ import ...flags across successive calls on the same instance.
REPL Inspect
from codeop import CommandCompiler
help(CommandCompiler)
Linked from
Related notes
- tuts/python3/stdlib_module/codeop/Compile Linked here; links to this page; shared tags: #codeop, #stdlib
- tuts/python3/stdlib_module/codeop/compile_command Linked here; links to this page; shared tags: #codeop, #stdlib
- tuts/python3/stdlib_module/codeop Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib