Copyright (C) 2000-2012 |
GNU Info (python2.1-lib.info)Queries on AST ObjectsQueries on AST Objects ---------------------- 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()'. `isexpr(ast)' When AST represents an `'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. `issuite(ast)' This function mirrors `isexpr()' in that it reports whether an AST object represents an `'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. automatically generated by info2www version 1.2.2.9 |