Two functions are provided which allow an application to determine if an AST was created as an expression or a suite. Neither of these functions can be used to determine if an AST was created from source code via expr() or suite() or from a parse tree via sequence2ast().
'eval'form, this function returns true, otherwise it returns false. This is useful, since code objects normally cannot be queried for this information using existing built-in functions. Note that the code objects created by compileast() cannot be queried like this either, and are identical to those created by the built-in compile() function.
'exec'form, commonly known as a ``suite.'' It is not safe to assume that this function is equivalent to "not isexpr(ast)", as additional syntactic fragments may be supported in the future.
See About this document... for information on suggesting changes.