Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / html / python / tut / tut.html
CommitLineData
86530b38
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="tut.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="tut.html" title='Python Tutorial' />
8<link rel='contents' href='node2.html' title="Contents" />
9<link rel='index' href='node19.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="node1.html" />
13<meta name='aesop' content='information' />
14<title>Python Tutorial</title>
15</head>
16<body>
17<DIV CLASS="navigation">
18<div id='top-navigation-panel' xml:id='top-navigation-panel'>
19<table align="center" width="100%" cellpadding="0" cellspacing="2">
20<tr>
21<td class='online-navigation'><img src='../icons/previous.png'
22 border='0' height='32' alt='Previous Page' width='32' /></td>
23<td class='online-navigation'><a rel="parent" title="Python Documentation Index"
24 href="../index.html"><img src='../icons/up.png'
25 border='0' height='32' alt='Up One Level' width='32' /></A></td>
26<td class='online-navigation'><a rel="next" title="Front Matter"
27 href="node1.html"><img src='../icons/next.png'
28 border='0' height='32' alt='Next Page' width='32' /></A></td>
29<td align="center" width="100%">Python Tutorial</td>
30<td class='online-navigation'><a rel="contents" title="Table of Contents"
31 href="node2.html"><img src='../icons/contents.png'
32 border='0' height='32' alt='Contents' width='32' /></A></td>
33<td class='online-navigation'><img src='../icons/blank.png'
34 border='0' height='32' alt='' width='32' /></td>
35<td class='online-navigation'><a rel="index" title="Index"
36 href="node19.html"><img src='../icons/index.png'
37 border='0' height='32' alt='Index' width='32' /></A></td>
38</tr></table>
39<div class='online-navigation'>
40<b class="navlabel">Up:</b>
41<a class="sectref" rel="parent" href="../index.html">Python Documentation Index</A>
42<b class="navlabel">Next:</b>
43<a class="sectref" rel="next" href="node1.html">Front Matter</A>
44</div>
45<hr /></div>
46</DIV>
47<!--End of Navigation Panel-->
48
49<P>
50
51<link rel='up' href='../index.html' title='Python Documentation Index' />
52<div class="titlepage">
53<div class='center'>
54<h1>Python Tutorial</h1>
55<p><b><font size="+2">Guido van Rossum</font></b></p>
56<p>
57 <strong>Python Software Foundation</strong>
58<BR>
59Email: <span class="email">docs@python.org</span>
60</p>
61<p><i> Fred L. Drake, Jr., editor</i></p>
62<p><strong>Release 2.4.2</strong><br />
63<strong>28 September 2005</strong></p>
64<p></p>
65</div>
66</div>
67
68<P>
69
70<p><br /></p><hr class='online-navigation' />
71<div class='online-navigation'>
72<!--Table of Child-Links-->
73<A NAME="CHILD_LINKS"></a>
74
75<UL CLASS="ChildLinks">
76<LI><A href="node1.html">Front Matter</a>
77<LI><A href="node2.html">Contents</a>
78<LI><A href="node3.html">1. Whetting Your Appetite</a>
79<LI><A href="node4.html">2. Using the Python Interpreter</a>
80<UL>
81<LI><A href="node4.html#SECTION004100000000000000000">2.1 Invoking the Interpreter</a>
82<UL>
83<LI><A href="node4.html#SECTION004110000000000000000">2.1.1 Argument Passing</a>
84<LI><A href="node4.html#SECTION004120000000000000000">2.1.2 Interactive Mode</a>
85</ul>
86<LI><A href="node4.html#SECTION004200000000000000000">2.2 The Interpreter and Its Environment</a>
87<UL>
88<LI><A href="node4.html#SECTION004210000000000000000">2.2.1 Error Handling</a>
89<LI><A href="node4.html#SECTION004220000000000000000">2.2.2 Executable Python Scripts</a>
90<LI><A href="node4.html#SECTION004230000000000000000">2.2.3 Source Code Encoding</a>
91<LI><A href="node4.html#SECTION004240000000000000000">2.2.4 The Interactive Startup File</a>
92</ul>
93</ul>
94<LI><A href="node5.html">3. An Informal Introduction to Python</a>
95<UL>
96<LI><A href="node5.html#SECTION005100000000000000000">3.1 Using Python as a Calculator</a>
97<UL>
98<LI><A href="node5.html#SECTION005110000000000000000">3.1.1 Numbers</a>
99<LI><A href="node5.html#SECTION005120000000000000000">3.1.2 Strings</a>
100<LI><A href="node5.html#SECTION005130000000000000000">3.1.3 Unicode Strings</a>
101<LI><A href="node5.html#SECTION005140000000000000000">3.1.4 Lists</a>
102</ul>
103<LI><A href="node5.html#SECTION005200000000000000000">3.2 First Steps Towards Programming</a>
104</ul>
105<LI><A href="node6.html">4. More Control Flow Tools</a>
106<UL>
107<LI><A href="node6.html#SECTION006100000000000000000">4.1 <tt class="keyword">if</tt> Statements</a>
108<LI><A href="node6.html#SECTION006200000000000000000">4.2 <tt class="keyword">for</tt> Statements</a>
109<LI><A href="node6.html#SECTION006300000000000000000">4.3 The <tt class="function">range()</tt> Function</a>
110<LI><A href="node6.html#SECTION006400000000000000000">4.4 <tt class="keyword">break</tt> and <tt class="keyword">continue</tt> Statements, and
111 <tt class="keyword">else</tt> Clauses on Loops</a>
112<LI><A href="node6.html#SECTION006500000000000000000">4.5 <tt class="keyword">pass</tt> Statements</a>
113<LI><A href="node6.html#SECTION006600000000000000000">4.6 Defining Functions</a>
114<LI><A href="node6.html#SECTION006700000000000000000">4.7 More on Defining Functions</a>
115<UL>
116<LI><A href="node6.html#SECTION006710000000000000000">4.7.1 Default Argument Values</a>
117<LI><A href="node6.html#SECTION006720000000000000000">4.7.2 Keyword Arguments</a>
118<LI><A href="node6.html#SECTION006730000000000000000">4.7.3 Arbitrary Argument Lists</a>
119<LI><A href="node6.html#SECTION006740000000000000000">4.7.4 Unpacking Argument Lists</a>
120<LI><A href="node6.html#SECTION006750000000000000000">4.7.5 Lambda Forms</a>
121<LI><A href="node6.html#SECTION006760000000000000000">4.7.6 Documentation Strings</a>
122</ul>
123</ul>
124<LI><A href="node7.html">5. Data Structures</a>
125<UL>
126<LI><A href="node7.html#SECTION007100000000000000000">5.1 More on Lists</a>
127<UL>
128<LI><A href="node7.html#SECTION007110000000000000000">5.1.1 Using Lists as Stacks</a>
129<LI><A href="node7.html#SECTION007120000000000000000">5.1.2 Using Lists as Queues</a>
130<LI><A href="node7.html#SECTION007130000000000000000">5.1.3 Functional Programming Tools</a>
131<LI><A href="node7.html#SECTION007140000000000000000">5.1.4 List Comprehensions</a>
132</ul>
133<LI><A href="node7.html#SECTION007200000000000000000">5.2 The <tt class="keyword">del</tt> statement</a>
134<LI><A href="node7.html#SECTION007300000000000000000">5.3 Tuples and Sequences</a>
135<LI><A href="node7.html#SECTION007400000000000000000">5.4 Sets</a>
136<LI><A href="node7.html#SECTION007500000000000000000">5.5 Dictionaries</a>
137<LI><A href="node7.html#SECTION007600000000000000000">5.6 Looping Techniques</a>
138<LI><A href="node7.html#SECTION007700000000000000000">5.7 More on Conditions</a>
139<LI><A href="node7.html#SECTION007800000000000000000">5.8 Comparing Sequences and Other Types</a>
140</ul>
141<LI><A href="node8.html">6. Modules</a>
142<UL>
143<LI><A href="node8.html#SECTION008100000000000000000">6.1 More on Modules</a>
144<UL>
145<LI><A href="node8.html#SECTION008110000000000000000">6.1.1 The Module Search Path</a>
146<LI><A href="node8.html#SECTION008120000000000000000">6.1.2 ``Compiled'' Python files</a>
147</ul>
148<LI><A href="node8.html#SECTION008200000000000000000">6.2 Standard Modules</a>
149<LI><A href="node8.html#SECTION008300000000000000000">6.3 The <tt class="function">dir()</tt> Function</a>
150<LI><A href="node8.html#SECTION008400000000000000000">6.4 Packages</a>
151<UL>
152<LI><A href="node8.html#SECTION008410000000000000000">6.4.1 Importing * From a Package</a>
153<LI><A href="node8.html#SECTION008420000000000000000">6.4.2 Intra-package References</a>
154<LI><A href="node8.html#SECTION008430000000000000000">6.4.3 Packages in Multiple Directories</a>
155</ul>
156</ul>
157<LI><A href="node9.html">7. Input and Output</a>
158<UL>
159<LI><A href="node9.html#SECTION009100000000000000000">7.1 Fancier Output Formatting</a>
160<LI><A href="node9.html#SECTION009200000000000000000">7.2 Reading and Writing Files</a>
161<UL>
162<LI><A href="node9.html#SECTION009210000000000000000">7.2.1 Methods of File Objects</a>
163<LI><A href="node9.html#SECTION009220000000000000000">7.2.2 The <tt class="module">pickle</tt> Module</a>
164</ul>
165</ul>
166<LI><A href="node10.html">8. Errors and Exceptions</a>
167<UL>
168<LI><A href="node10.html#SECTION0010100000000000000000">8.1 Syntax Errors</a>
169<LI><A href="node10.html#SECTION0010200000000000000000">8.2 Exceptions</a>
170<LI><A href="node10.html#SECTION0010300000000000000000">8.3 Handling Exceptions</a>
171<LI><A href="node10.html#SECTION0010400000000000000000">8.4 Raising Exceptions</a>
172<LI><A href="node10.html#SECTION0010500000000000000000">8.5 User-defined Exceptions</a>
173<LI><A href="node10.html#SECTION0010600000000000000000">8.6 Defining Clean-up Actions</a>
174</ul>
175<LI><A href="node11.html">9. Classes</a>
176<UL>
177<LI><A href="node11.html#SECTION0011100000000000000000">9.1 A Word About Terminology</a>
178<LI><A href="node11.html#SECTION0011200000000000000000">9.2 Python Scopes and Name Spaces</a>
179<LI><A href="node11.html#SECTION0011300000000000000000">9.3 A First Look at Classes</a>
180<UL>
181<LI><A href="node11.html#SECTION0011310000000000000000">9.3.1 Class Definition Syntax</a>
182<LI><A href="node11.html#SECTION0011320000000000000000">9.3.2 Class Objects</a>
183<LI><A href="node11.html#SECTION0011330000000000000000">9.3.3 Instance Objects</a>
184<LI><A href="node11.html#SECTION0011340000000000000000">9.3.4 Method Objects</a>
185</ul>
186<LI><A href="node11.html#SECTION0011400000000000000000">9.4 Random Remarks</a>
187<LI><A href="node11.html#SECTION0011500000000000000000">9.5 Inheritance</a>
188<UL>
189<LI><A href="node11.html#SECTION0011510000000000000000">9.5.1 Multiple Inheritance</a>
190</ul>
191<LI><A href="node11.html#SECTION0011600000000000000000">9.6 Private Variables</a>
192<LI><A href="node11.html#SECTION0011700000000000000000">9.7 Odds and Ends</a>
193<LI><A href="node11.html#SECTION0011800000000000000000">9.8 Exceptions Are Classes Too</a>
194<LI><A href="node11.html#SECTION0011900000000000000000">9.9 Iterators</a>
195<LI><A href="node11.html#SECTION00111000000000000000000">9.10 Generators</a>
196<LI><A href="node11.html#SECTION00111100000000000000000">9.11 Generator Expressions</a>
197</ul>
198<LI><A href="node12.html">10. Brief Tour of the Standard Library</a>
199<UL>
200<LI><A href="node12.html#SECTION0012100000000000000000">10.1 Operating System Interface</a>
201<LI><A href="node12.html#SECTION0012200000000000000000">10.2 File Wildcards</a>
202<LI><A href="node12.html#SECTION0012300000000000000000">10.3 Command Line Arguments</a>
203<LI><A href="node12.html#SECTION0012400000000000000000">10.4 Error Output Redirection and Program Termination</a>
204<LI><A href="node12.html#SECTION0012500000000000000000">10.5 String Pattern Matching</a>
205<LI><A href="node12.html#SECTION0012600000000000000000">10.6 Mathematics</a>
206<LI><A href="node12.html#SECTION0012700000000000000000">10.7 Internet Access</a>
207<LI><A href="node12.html#SECTION0012800000000000000000">10.8 Dates and Times</a>
208<LI><A href="node12.html#SECTION0012900000000000000000">10.9 Data Compression</a>
209<LI><A href="node12.html#SECTION00121000000000000000000">10.10 Performance Measurement</a>
210<LI><A href="node12.html#SECTION00121100000000000000000">10.11 Quality Control</a>
211<LI><A href="node12.html#SECTION00121200000000000000000">10.12 Batteries Included</a>
212</ul>
213<LI><A href="node13.html">11. Brief Tour of the Standard Library - Part II</a>
214<UL>
215<LI><A href="node13.html#SECTION0013100000000000000000">11.1 Output Formatting</a>
216<LI><A href="node13.html#SECTION0013200000000000000000">11.2 Templating</a>
217<LI><A href="node13.html#SECTION0013300000000000000000">11.3 Working with Binary Data Record Layouts</a>
218<LI><A href="node13.html#SECTION0013400000000000000000">11.4 Multi-threading</a>
219<LI><A href="node13.html#SECTION0013500000000000000000">11.5 Logging</a>
220<LI><A href="node13.html#SECTION0013600000000000000000">11.6 Weak References</a>
221<LI><A href="node13.html#SECTION0013700000000000000000">11.7 Tools for Working with Lists</a>
222<LI><A href="node13.html#SECTION0013800000000000000000">11.8 Decimal Floating Point Arithmetic</a>
223</ul>
224<LI><A href="node14.html">12. What Now?</a>
225<LI><A href="node15.html">A. Interactive Input Editing and History Substitution</a>
226<UL>
227<LI><A href="node15.html#SECTION0015100000000000000000">A.1 Line Editing</a>
228<LI><A href="node15.html#SECTION0015200000000000000000">A.2 History Substitution</a>
229<LI><A href="node15.html#SECTION0015300000000000000000">A.3 Key Bindings</a>
230<LI><A href="node15.html#SECTION0015400000000000000000">A.4 Commentary</a>
231</ul>
232<LI><A href="node16.html">B. Floating Point Arithmetic: Issues and Limitations</a>
233<UL>
234<LI><A href="node16.html#SECTION0016100000000000000000">B.1 Representation Error</a>
235</ul>
236<LI><A href="node17.html">C. History and License</a>
237<UL>
238<LI><A href="node17.html#SECTION0017100000000000000000">C.1 History of the software</a>
239<LI><A href="node17.html#SECTION0017200000000000000000">C.2 Terms and conditions for accessing or otherwise using Python</a>
240<LI><A href="node17.html#SECTION0017300000000000000000">C.3 Licenses and Acknowledgements for Incorporated Software</a>
241<UL>
242<LI><A href="node17.html#SECTION0017310000000000000000">C.3.1 Mersenne Twister</a>
243<LI><A href="node17.html#SECTION0017320000000000000000">C.3.2 Sockets</a>
244<LI><A href="node17.html#SECTION0017330000000000000000">C.3.3 Floating point exception control</a>
245<LI><A href="node17.html#SECTION0017340000000000000000">C.3.4 MD5 message digest algorithm</a>
246<LI><A href="node17.html#SECTION0017350000000000000000">C.3.5 Asynchronous socket services</a>
247<LI><A href="node17.html#SECTION0017360000000000000000">C.3.6 Cookie management</a>
248<LI><A href="node17.html#SECTION0017370000000000000000">C.3.7 Profiling</a>
249<LI><A href="node17.html#SECTION0017380000000000000000">C.3.8 Execution tracing</a>
250<LI><A href="node17.html#SECTION0017390000000000000000">C.3.9 UUencode and UUdecode functions</a>
251<LI><A href="node17.html#SECTION00173100000000000000000">C.3.10 XML Remote Procedure Calls</a>
252</ul>
253</ul>
254<LI><A href="node18.html">D. Glossary</a>
255<LI><A href="node19.html">Index</a>
256<LI><A href="node20.html">About this document ...</a>
257</ul>
258<!--End of Table of Child-Links-->
259</div>
260
261<DIV CLASS="navigation">
262<div class='online-navigation'>
263<p></p><hr />
264<table align="center" width="100%" cellpadding="0" cellspacing="2">
265<tr>
266<td class='online-navigation'><img src='../icons/previous.png'
267 border='0' height='32' alt='Previous Page' width='32' /></td>
268<td class='online-navigation'><a rel="parent" title="Python Documentation Index"
269 href="../index.html"><img src='../icons/up.png'
270 border='0' height='32' alt='Up One Level' width='32' /></A></td>
271<td class='online-navigation'><a rel="next" title="Front Matter"
272 href="node1.html"><img src='../icons/next.png'
273 border='0' height='32' alt='Next Page' width='32' /></A></td>
274<td align="center" width="100%">Python Tutorial</td>
275<td class='online-navigation'><a rel="contents" title="Table of Contents"
276 href="node2.html"><img src='../icons/contents.png'
277 border='0' height='32' alt='Contents' width='32' /></A></td>
278<td class='online-navigation'><img src='../icons/blank.png'
279 border='0' height='32' alt='' width='32' /></td>
280<td class='online-navigation'><a rel="index" title="Index"
281 href="node19.html"><img src='../icons/index.png'
282 border='0' height='32' alt='Index' width='32' /></A></td>
283</tr></table>
284<div class='online-navigation'>
285<b class="navlabel">Up:</b>
286<a class="sectref" rel="parent" href="../index.html">Python Documentation Index</A>
287<b class="navlabel">Next:</b>
288<a class="sectref" rel="next" href="node1.html">Front Matter</A>
289</div>
290</div>
291<hr />
292<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
293</DIV>
294<!--End of Navigation Panel-->
295<ADDRESS>
296See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
297</ADDRESS>
298</BODY>
299</HTML>