A dictionary of global variables. By default, this is initialized
with fromsympyimport*; provide this parameter to override
this behavior (for instance, to parse "Q&S").

transformations : tuple, optional

A tuple of transformation functions used to modify the tokens of the
parsed expression before evaluation. The default transformations
convert numeric literals into their SymPy equivalents, convert
undefined variables into SymPy symbols, and allow the use of standard
mathematical factorial notation (e.g. x!).

evaluate : bool, optional

When False, the order of the arguments will remain as they were in the
string and automatic simplification that would normally occur is
suppressed. (see examples)

The tokenize() function accepts two parameters: one representing the
input stream, and one providing an output mechanism for tokenize().

The first parameter, readline, must be a callable object which provides
the same interface as the readline() method of built-in file objects.
Each call to the function should return one line of input as a string.

The second parameter, tokeneater, must also be a callable object. It is
called once for each token, with five arguments, corresponding to the
tuples generated by generate_tokens().

Each element returned by the iterable must be a token sequence
with at least two elements, a token number and token value. If
only two tokens are passed, the resulting output is poor.

Round-trip invariant for full input:

Untokenized source will match input source exactly

Round-trip invariant for limited intput:

# Output text will tokenize the back to the inputt1=[tok[:2]fortokingenerate_tokens(f.readline)]newcode=untokenize(t1)readline=iter(newcode.splitlines(1)).nextt2=[tok[:2]fortokingenerate_tokens(readline)]ift1!=t2:raiseValueError("t1 should be equal to t2")

The generate_tokens() generator requires one argment, readline, which
must be a callable object which provides the same interface as the
readline() method of built-in file objects. Each call to the function
should return one line of input as a string. Alternately, readline
can be a callable function terminating with StopIteration:

readline=open(myfile).next# Example of alternate readline

The generator produces 5-tuples with these members: the token type; the
token string; a 2-tuple (srow, scol) of ints specifying the row and
column where the token begins in the source; a 2-tuple (erow, ecol) of
ints specifying the row and column where the token ends in the source;
and the line on which the token was found. The line passed is the
logical line; continuation lines are included.

A transformation is a function that accepts the arguments tokens,local_dict,global_dict and returns a list of transformed tokens. They can
be used by passing a list of functions to parse_expr() and are
applied in the order given.