Module codeop :: Class CommandCompiler
[hide private]
[frames] | no frames]

_ClassType 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, the instance 'remembers' and compiles all subsequent program texts with the statement in force.

Instance Methods [hide private]
 
__init__(self)
 
__call__(self, source, filename='<input>', symbol='single')
Compile a command and determine whether it is incomplete.
Method Details [hide private]

__call__(self, source, filename='<input>', symbol='single')
(Call operator)

 
Compile a command and determine whether it is incomplete.

Arguments:

source -- the source string; may contain \n characters
filename -- optional filename from which source was read;
            default "<input>"
symbol -- optional grammar start symbol; "single" (default) or
          "eval"

Return value / exceptions raised:

- Return a code object if the command is complete and valid
- Return None if the command is incomplete
- Raise SyntaxError, ValueError or OverflowError if the command is a
  syntax error (OverflowError and ValueError can be produced by
  malformed literals).