Python Reference Manual - MIT
Python Reference Manual
Release 2.1.1
Guido van Rossum
Fred L. Drake, Jr., editor
July 20, 2001
PythonLabs
E-mail:
python-docs@
Copyright c 2001 Python Software Foundation. All rights reserved.
Copyright c 2000 . All rights reserved.
Copyright c 1995-2000 Corporation for National Research Initiatives. All rights reserved.
Copyright c 1991-1995 Stichting Mathematisch Centrum. All rights reserved.
See the end of this document for complete license and permissions information.
Abstract
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level
built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for rapid application development, as well as for use as a scripting or glue language to connect existing components together. Python¡¯s
simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python
supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and
the extensive standard library are available in source or binary form without charge for all major platforms, and can be
freely distributed.
This reference manual describes the syntax and ¡°core semantics¡± of the language. It is terse, but attempts to be exact
and complete. The semantics of non-essential built-in object types and of the built-in functions and modules are
described in the Python Library Reference. For an informal introduction to the language, see the Python Tutorial. For
C or C++ programmers, two additional manuals exist: Extending and Embedding the Python Interpreter describes the
high-level picture of how to write a Python extension module, and the Python/C API Reference Manual describes the
interfaces available to C/C++ programmers in detail.
CONTENTS
1
Introduction
1.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
Lexical analysis
2.1 Line structure . . . . . .
2.2 Other tokens . . . . . .
2.3 Identifiers and keywords
2.4 Literals . . . . . . . . .
2.5 Operators . . . . . . . .
2.6 Delimiters . . . . . . .
1
1
.
.
.
.
.
.
3
3
5
6
6
9
10
3
Data model
3.1 Objects, values and types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 The standard type hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.3 Special method names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
11
12
17
4
Execution model
4.1 Code blocks, execution frames, and namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4.2 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
25
26
5
Expressions
5.1 Arithmetic conversions . . .
5.2 Atoms . . . . . . . . . . .
5.3 Primaries . . . . . . . . . .
5.4 The power operator . . . . .
5.5 Unary arithmetic operations
5.6 Binary arithmetic operations
5.7 Shifting operations . . . . .
5.8 Binary bit-wise operations .
5.9 Comparisons . . . . . . . .
5.10 Boolean operations . . . . .
5.11 Expression lists . . . . . . .
5.12 Summary . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
29
29
29
32
34
35
35
36
36
36
37
38
39
Simple statements
6.1 Expression statements
6.2 Assert statements . .
6.3 Assignment statements
6.4 The pass statement .
6.5 The del statement .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
41
41
41
42
44
44
6
.
.
.
.
.
.
.
.
.
.
.
.
. . .
. . .
. .
. . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
i
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- python 3 cheatsheet the basics grok
- python fundamentals syllabus rooman
- lab manual python programming lab 6cs4 23
- python reference manual mit
- basic python programming for loops and reading files
- python cheat sheet
- python quick guide tutorialspoint
- object oriented design with python
- introduction to python
- real python python 3 cheat sheet
Related searches
- microsoft vba reference manual pdf
- numpy reference manual pdf
- icd 10 pcs reference manual 2019
- verilog hdl reference manual pdf
- systemverilog language reference manual pdf
- verilog reference manual pdf
- python reference manual pdf
- python reference guide pdf
- python language reference manual pdf
- sql language reference manual pdf
- python reference sheet
- aapd reference manual pdf