Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
2 | <html> | |
3 | <head> | |
4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> | |
5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> | |
6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> | |
7 | <link rel="first" href="lib.html" title='Python Library Reference' /> | |
8 | <link rel='contents' href='contents.html' title="Contents" /> | |
9 | <link rel='index' href='genindex.html' title='Index' /> | |
10 | <link rel='last' href='about.html' title='About this document...' /> | |
11 | <link rel='help' href='about.html' title='About this document...' /> | |
12 | <link rel="next" href="node772.html" /> | |
13 | <link rel="prev" href="node770.html" /> | |
14 | <link rel="parent" href="module-parser.html" /> | |
15 | <link rel="next" href="node772.html" /> | |
16 | <meta name='aesop' content='information' /> | |
17 | <title>18.1.5 AST Objects </title> | |
18 | </head> | |
19 | <body> | |
20 | <DIV CLASS="navigation"> | |
21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> | |
22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
23 | <tr> | |
24 | <td class='online-navigation'><a rel="prev" title="18.1.4 Exceptions and Error" | |
25 | href="node770.html"><img src='../icons/previous.png' | |
26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
27 | <td class='online-navigation'><a rel="parent" title="18.1 parser " | |
28 | href="module-parser.html"><img src='../icons/up.png' | |
29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
30 | <td class='online-navigation'><a rel="next" title="18.1.6 Examples" | |
31 | href="node772.html"><img src='../icons/next.png' | |
32 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
33 | <td align="center" width="100%">Python Library Reference</td> | |
34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
35 | href="contents.html"><img src='../icons/contents.png' | |
36 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
38 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
39 | <td class='online-navigation'><a rel="index" title="Index" | |
40 | href="genindex.html"><img src='../icons/index.png' | |
41 | border='0' height='32' alt='Index' width='32' /></A></td> | |
42 | </tr></table> | |
43 | <div class='online-navigation'> | |
44 | <b class="navlabel">Previous:</b> | |
45 | <a class="sectref" rel="prev" href="node770.html">18.1.4 Exceptions and Error</A> | |
46 | <b class="navlabel">Up:</b> | |
47 | <a class="sectref" rel="parent" href="module-parser.html">18.1 parser </A> | |
48 | <b class="navlabel">Next:</b> | |
49 | <a class="sectref" rel="next" href="node772.html">18.1.6 Examples</A> | |
50 | </div> | |
51 | <hr /></div> | |
52 | </DIV> | |
53 | <!--End of Navigation Panel--> | |
54 | ||
55 | <H2><A NAME="SECTION0020150000000000000000"></A><A NAME="AST_Objects"></A> | |
56 | <BR> | |
57 | 18.1.5 AST Objects | |
58 | </H2> | |
59 | ||
60 | <P> | |
61 | Ordered and equality comparisons are supported between AST objects. | |
62 | Pickling of AST objects (using the <tt class="module"><a href="module-pickle.html">pickle</a></tt> module) is also | |
63 | supported. | |
64 | ||
65 | <P> | |
66 | <dl><dt><b><tt id='l2h-4950' xml:id='l2h-4950'>ASTType</tt></b></dt> | |
67 | <dd> | |
68 | The type of the objects returned by <tt class="function">expr()</tt>, | |
69 | <tt class="function">suite()</tt> and <tt class="function">sequence2ast()</tt>. | |
70 | </dd></dl> | |
71 | ||
72 | <P> | |
73 | AST objects have the following methods: | |
74 | ||
75 | <P> | |
76 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
77 | <td><nobr><b><tt id='l2h-4951' xml:id='l2h-4951' class="method">compile</tt></b>(</nobr></td> | |
78 | <td><var></var><big>[</big><var>filename</var><big>]</big><var></var>)</td></tr></table></dt> | |
79 | <dd> | |
80 | Same as <code>compileast(<var>ast</var>, <var>filename</var>)</code>. | |
81 | </dl> | |
82 | ||
83 | <P> | |
84 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
85 | <td><nobr><b><tt id='l2h-4952' xml:id='l2h-4952' class="method">isexpr</tt></b>(</nobr></td> | |
86 | <td><var></var>)</td></tr></table></dt> | |
87 | <dd> | |
88 | Same as <code>isexpr(<var>ast</var>)</code>. | |
89 | </dl> | |
90 | ||
91 | <P> | |
92 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
93 | <td><nobr><b><tt id='l2h-4953' xml:id='l2h-4953' class="method">issuite</tt></b>(</nobr></td> | |
94 | <td><var></var>)</td></tr></table></dt> | |
95 | <dd> | |
96 | Same as <code>issuite(<var>ast</var>)</code>. | |
97 | </dl> | |
98 | ||
99 | <P> | |
100 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
101 | <td><nobr><b><tt id='l2h-4954' xml:id='l2h-4954' class="method">tolist</tt></b>(</nobr></td> | |
102 | <td><var></var><big>[</big><var>line_info</var><big>]</big><var></var>)</td></tr></table></dt> | |
103 | <dd> | |
104 | Same as <code>ast2list(<var>ast</var>, <var>line_info</var>)</code>. | |
105 | </dl> | |
106 | ||
107 | <P> | |
108 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> | |
109 | <td><nobr><b><tt id='l2h-4955' xml:id='l2h-4955' class="method">totuple</tt></b>(</nobr></td> | |
110 | <td><var></var><big>[</big><var>line_info</var><big>]</big><var></var>)</td></tr></table></dt> | |
111 | <dd> | |
112 | Same as <code>ast2tuple(<var>ast</var>, <var>line_info</var>)</code>. | |
113 | </dl> | |
114 | ||
115 | <P> | |
116 | ||
117 | <DIV CLASS="navigation"> | |
118 | <div class='online-navigation'> | |
119 | <p></p><hr /> | |
120 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> | |
121 | <tr> | |
122 | <td class='online-navigation'><a rel="prev" title="18.1.4 Exceptions and Error" | |
123 | href="node770.html"><img src='../icons/previous.png' | |
124 | border='0' height='32' alt='Previous Page' width='32' /></A></td> | |
125 | <td class='online-navigation'><a rel="parent" title="18.1 parser " | |
126 | href="module-parser.html"><img src='../icons/up.png' | |
127 | border='0' height='32' alt='Up One Level' width='32' /></A></td> | |
128 | <td class='online-navigation'><a rel="next" title="18.1.6 Examples" | |
129 | href="node772.html"><img src='../icons/next.png' | |
130 | border='0' height='32' alt='Next Page' width='32' /></A></td> | |
131 | <td align="center" width="100%">Python Library Reference</td> | |
132 | <td class='online-navigation'><a rel="contents" title="Table of Contents" | |
133 | href="contents.html"><img src='../icons/contents.png' | |
134 | border='0' height='32' alt='Contents' width='32' /></A></td> | |
135 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' | |
136 | border='0' height='32' alt='Module Index' width='32' /></a></td> | |
137 | <td class='online-navigation'><a rel="index" title="Index" | |
138 | href="genindex.html"><img src='../icons/index.png' | |
139 | border='0' height='32' alt='Index' width='32' /></A></td> | |
140 | </tr></table> | |
141 | <div class='online-navigation'> | |
142 | <b class="navlabel">Previous:</b> | |
143 | <a class="sectref" rel="prev" href="node770.html">18.1.4 Exceptions and Error</A> | |
144 | <b class="navlabel">Up:</b> | |
145 | <a class="sectref" rel="parent" href="module-parser.html">18.1 parser </A> | |
146 | <b class="navlabel">Next:</b> | |
147 | <a class="sectref" rel="next" href="node772.html">18.1.6 Examples</A> | |
148 | </div> | |
149 | </div> | |
150 | <hr /> | |
151 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> | |
152 | </DIV> | |
153 | <!--End of Navigation Panel--> | |
154 | <ADDRESS> | |
155 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. | |
156 | </ADDRESS> | |
157 | </BODY> | |
158 | </HTML> |